Skip to content

Commit 0084304

Browse files
committed
@unittest.skipif
1 parent 3d6db66 commit 0084304

10 files changed

+21
-46
lines changed

e2e/test_authorization.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import uuid
2-
import sys
2+
import unittest
33
from typing import Set
44

55
from lib.apigee import ApigeeApp
@@ -19,11 +19,9 @@
1919
from utils.constants import env_internal_dev
2020

2121

22+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
2223
class TestApplicationRestrictedAuthorization(ImmunizationBaseTest):
2324

24-
if env_internal_dev:
25-
sys.exit()
26-
2725
my_app: ApigeeApp
2826
my_imms_api: ImmunisationApi
2927

e2e/test_create_immunization.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import sys
1+
import unittest
22
from utils.base_test import ImmunizationBaseTest
33
from utils.resource import generate_imms_resource, get_full_row_from_identifier
44
from utils.constants import env_internal_dev
55

66

7+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
78
class TestCreateImmunization(ImmunizationBaseTest):
89

9-
if env_internal_dev:
10-
sys.exit()
11-
1210
def test_create_imms(self):
1311
"""it should create a FHIR Immunization resource"""
1412
for imms_api in self.imms_apis:

e2e/test_delete_immunization.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import sys
1+
import unittest
22
from utils.base_test import ImmunizationBaseTest
33
from utils.immunisation_api import parse_location
44
from utils.resource import generate_imms_resource
55
from utils.constants import env_internal_dev
66

77

8+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
89
class TestDeleteImmunization(ImmunizationBaseTest):
910

10-
if env_internal_dev:
11-
sys.exit()
12-
1311
def test_delete_imms(self):
1412
"""it should delete a FHIR Immunization resource"""
1513
for imms_api in self.imms_apis:

e2e/test_delta_immunization.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
import boto3
1010
from botocore.config import Config
1111
import os
12-
import sys
12+
import unittest
1313

1414

15+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
1516
class TestDeltaImmunization(ImmunizationBaseTest):
1617

17-
if env_internal_dev:
18-
sys.exit()
19-
2018
CREATE_OPERATION = "CREATE"
2119
UPDATE_OPERATION = "UPDATE"
2220
DELETE_OPERATION = "DELETE"

e2e/test_get_immunization.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from decimal import Decimal
22
import uuid
3-
import sys
3+
import unittest
44

55
from utils.base_test import ImmunizationBaseTest
66
from utils.immunisation_api import parse_location
@@ -9,11 +9,9 @@
99
from utils.constants import env_internal_dev
1010

1111

12+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
1213
class TestGetImmunization(ImmunizationBaseTest):
1314

14-
if env_internal_dev:
15-
sys.exit()
16-
1715
def test_get_imms(self):
1816
"""it should get a FHIR Immunization resource"""
1917
for imms_api in self.imms_apis:

e2e/test_proxy.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
import subprocess
33
import unittest
44
import uuid
5-
import sys
5+
import unittest
66
import requests
77

88
from lib.env import get_service_base_path, get_status_endpoint_api_key
99
from utils.constants import env_internal_dev
1010

1111

12+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
1213
class TestProxyHealthcheck(unittest.TestCase):
1314

14-
if env_internal_dev:
15-
sys.exit()
16-
1715
proxy_url: str
1816
status_api_key: str
1917

@@ -36,12 +34,10 @@ def test_status(self):
3634
f"service is not healthy: status: {body['status']}")
3735

3836

37+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
3938
class TestMtls(unittest.TestCase):
4039
"""Our backend is secured using mTLS. This test makes sure you can't hit the backend directly"""
4140

42-
if env_internal_dev:
43-
sys.exit()
44-
4541
def test_mtls(self):
4642
"""backend should reject unauthorized connections"""
4743
backend_url = TestMtls.get_backend_url()
@@ -76,13 +72,11 @@ def get_backend_url() -> str:
7672
raise RuntimeError(f"Failed to run command\n{e}")
7773

7874

75+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
7976
class TestProxyAuthorization(unittest.TestCase):
8077
"""Our apigee proxy has its own authorization.
8178
This class test different authorization access levels/roles authentication types that are supported"""
8279

83-
if env_internal_dev:
84-
sys.exit()
85-
8680
proxy_url: str
8781

8882
@classmethod

e2e/test_search_immunization.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pprint
22
import uuid
3-
import sys
3+
import unittest
44
from typing import NamedTuple, Literal, Optional, List
55
from decimal import Decimal
66

@@ -11,14 +11,12 @@
1111
from utils.constants import env_internal_dev
1212

1313

14+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
1415
class TestSearchImmunization(ImmunizationBaseTest):
1516
# NOTE: In each test, the result may contain more hits. We only assert if the resource that we created is
1617
# in the result set and assert the one that we don't expect is not present.
1718
# This is to make these tests stateless otherwise; we need to clean up the db after each test
1819

19-
if env_internal_dev:
20-
sys.exit()
21-
2220
def store_records(self, *resources):
2321
ids = []
2422
for res in resources:

e2e/test_sqs_dlq.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
import json
33
import boto3
44
import os
5-
import sys
5+
import unittest
66
from utils.delete_sqs_messages import read_and_delete_messages
77
from utils.get_sqs_url import get_queue_url
88
from utils.constants import env_internal_dev
99
from botocore.exceptions import ClientError # Handle potential errors
1010

1111

12+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
1213
class TestSQS(unittest.TestCase):
1314

14-
if env_internal_dev:
15-
sys.exit()
16-
1715
def setUp(self):
1816
# Get SQS queue url
1917
self.queue_name = os.environ["AWS_SQS_QUEUE_NAME"]

e2e/test_update_immunization.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
import copy
22
import uuid
3-
import sys
3+
import unittest
44
from utils.base_test import ImmunizationBaseTest
55
from utils.immunisation_api import parse_location
66
from utils.resource import generate_imms_resource
77
from utils.constants import env_internal_dev
88

99

10+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
1011
class TestUpdateImmunization(ImmunizationBaseTest):
1112

12-
if env_internal_dev:
13-
sys.exit()
14-
1513
def test_update_imms(self):
1614
"""it should update a FHIR Immunization resource"""
1715
for imms_api in self.imms_apis:

e2e_batch/test_e2e_batch.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import sys
32
import unittest
43
from utils import (
54
generate_csv,
@@ -25,11 +24,9 @@
2524
)
2625

2726

27+
@unittest.skipIf(env_internal_dev, "Skip tests for internal-dev environment")
2828
class TestE2EBatch(unittest.TestCase):
2929

30-
if env_internal_dev:
31-
sys.exit()
32-
3330
if env_value != "ref":
3431

3532
def test_create_success(self):

0 commit comments

Comments
 (0)