Skip to content

Commit

Permalink
ISSUE #92 - Remove unittest_run_loop
Browse files Browse the repository at this point in the history
  • Loading branch information
vladyslav-fenchak committed Feb 16, 2022
1 parent 5f5cfdd commit 8ad997e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 34 deletions.
10 changes: 0 additions & 10 deletions tests/test_api_gateway/test_rest/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from aiohttp.test_utils import (
AioHTTPTestCase,
unittest_run_loop,
)

from minos.api_gateway.rest import (
Expand Down Expand Up @@ -43,7 +42,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_admin_login(self):
url = "/admin/login"

Expand All @@ -57,7 +55,6 @@ async def test_admin_login(self):
self.assertIn("id", await response.text())
self.assertIn("token", await response.text())

@unittest_run_loop
async def test_admin_login_no_data(self):
url = "/admin/login"

Expand All @@ -66,7 +63,6 @@ async def test_admin_login_no_data(self):
self.assertEqual(401, response.status)
self.assertDictEqual({"error": "Something went wrong!."}, json.loads(await response.text()))

@unittest_run_loop
async def test_admin_login_wrong_data(self):
url = "/admin/login"

Expand Down Expand Up @@ -105,7 +101,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_admin_get_endpoints(self):
url = "/admin/endpoints"

Expand Down Expand Up @@ -137,7 +132,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_admin_get_endpoints(self):
url = "/admin/endpoints"

Expand Down Expand Up @@ -168,15 +162,13 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_admin_get_rules(self):
url = "/admin/rules"

response = await self.client.request("GET", url)

self.assertEqual(200, response.status)

@unittest_run_loop
async def test_admin_create_rule(self):
url = "/admin/rules"

Expand All @@ -188,7 +180,6 @@ async def test_admin_create_rule(self):

self.assertEqual(200, response.status)

@unittest_run_loop
async def test_admin_update_rule(self):
url = "/admin/rules"

Expand All @@ -212,7 +203,6 @@ async def test_admin_update_rule(self):

self.assertEqual(200, response.status)

@unittest_run_loop
async def test_admin_delete_rule(self):
url = "/admin/rules"

Expand Down
12 changes: 0 additions & 12 deletions tests/test_api_gateway/test_rest/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from aiohttp.test_utils import (
AioHTTPTestCase,
unittest_run_loop,
)
from werkzeug.exceptions import (
abort,
Expand Down Expand Up @@ -88,7 +87,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_auth_headers_1(self):
url = "/order"
headers = {"Authorization": "Bearer credential-token-test"}
Expand All @@ -98,7 +96,6 @@ async def test_auth_headers_1(self):
self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_auth_headers_2(self):
url = "/merchants/5"
headers = {"Authorization": "Bearer credential-token-test"}
Expand All @@ -108,7 +105,6 @@ async def test_auth_headers_2(self):
self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_auth_headers_3(self):
url = "/categories/5"
headers = {"Authorization": "Bearer credential-token-test"}
Expand All @@ -118,7 +114,6 @@ async def test_auth_headers_3(self):
self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_default_auth_headers(self):
url = "/auth/token"
headers = {"Authorization": "Bearer credential-token-test"}
Expand All @@ -128,7 +123,6 @@ async def test_default_auth_headers(self):
self.assertEqual(200, response.status)
self.assertIn("token", await response.text())

@unittest_run_loop
async def test_auth(self):
url = "/auth/credentials"
headers = {"Authorization": "Bearer credential-token-test"}
Expand All @@ -138,7 +132,6 @@ async def test_auth(self):
self.assertEqual(200, response.status)
self.assertIn("uuid", await response.text())

@unittest_run_loop
async def test_wrong_auth_headers(self):
url = "/order"
headers = {"Authorization": "Bearer"} # Missing token
Expand All @@ -147,7 +140,6 @@ async def test_wrong_auth_headers(self):
self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_request_has_token(self):
url = "/order"
headers = {"Authorization": "Bearer"} # Missing token
Expand Down Expand Up @@ -193,7 +185,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_auth_disabled(self):
url = "/order"
headers = {"Authorization": "Bearer test_token"}
Expand Down Expand Up @@ -245,7 +236,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_auth_unauthorized(self):
await self.client.post(
"/admin/rules",
Expand Down Expand Up @@ -296,7 +286,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_auth_unreachable(self):
url = "/merchants/iweuwieuwe"
headers = {"Authorization": "Bearer test_token"}
Expand All @@ -305,7 +294,6 @@ async def test_auth_unreachable(self):
self.assertEqual(503, response.status)
self.assertEqual("The requested endpoint is not available.", await response.text())

@unittest_run_loop
async def test_auth(self):
url = "/auth/credentials"
headers = {"Authorization": "Bearer credential-token-test"}
Expand Down
2 changes: 0 additions & 2 deletions tests/test_api_gateway/test_rest/test_cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import attr
from aiohttp.test_utils import (
AioHTTPTestCase,
unittest_run_loop,
)
from aiohttp_middlewares.cors import (
ACCESS_CONTROL_ALLOW_HEADERS,
Expand Down Expand Up @@ -77,7 +76,6 @@ def check_allow_origin(
if allow_methods:
assert response.headers[ACCESS_CONTROL_ALLOW_METHODS] == ", ".join(allow_methods)

@unittest_run_loop
async def test_cors_enabled(self):
method = "GET"
extra_headers = {}
Expand Down
10 changes: 0 additions & 10 deletions tests/test_api_gateway/test_rest/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from aiohttp.test_utils import (
AioHTTPTestCase,
unittest_run_loop,
)
from werkzeug.exceptions import (
abort,
Expand Down Expand Up @@ -60,39 +59,34 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_get(self):
url = "/order/5?verb=GET&path=12324"
response = await self.client.request("GET", url)

self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_post(self):
url = "/order"
response = await self.client.request("POST", url)

self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_put(self):
url = "/order/5"
response = await self.client.request("PUT", url)

self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_patch(self):
url = "/order/5"
response = await self.client.request("PATCH", url)

self.assertEqual(200, response.status)
self.assertIn("Microservice call correct!!!", await response.text())

@unittest_run_loop
async def test_delete(self):
url = "/order/5"
response = await self.client.request("DELETE", url)
Expand Down Expand Up @@ -125,7 +119,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_get(self):
url = "/order/5?verb=GET&path=12324"
response = await self.client.request("GET", url)
Expand Down Expand Up @@ -160,7 +153,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_get(self):
url = "/order/5?verb=GET&path=12324"
response = await self.client.request("GET", url)
Expand All @@ -187,7 +179,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_get(self):
url = "/order/5?verb=GET&path=12324"
response = await self.client.request("GET", url)
Expand Down Expand Up @@ -224,7 +215,6 @@ async def get_application(self):

return await rest_service.create_application()

@unittest_run_loop
async def test_get(self):
url = "/order/5?verb=GET&path=12324"
response = await self.client.request("GET", url)
Expand Down

0 comments on commit 8ad997e

Please sign in to comment.