Skip to content

Commit d10efe4

Browse files
author
IdezHD
authored
Final Removal Of Org Enums (canada-ca#201)
* Removed references to org enum generation * Removed seeding from tests, as its only purpose was for enum creation * Remove TODO * Corrected error check * Completed tests for new scalar
1 parent e8c1ee2 commit d10efe4

21 files changed

Lines changed: 104 additions & 184 deletions

api/functions/generate_enums.py

Lines changed: 0 additions & 85 deletions
This file was deleted.

api/model_enums/organiztions.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

api/scalars/organization_acronym.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def parse_value(value):
2929
raise GraphQLError(scalar_error_type('String', value))
3030

3131
if not ACRONYM_REGEX.search(value):
32-
raise GraphQLError(scalar_error_type("String", value))
32+
raise GraphQLError(scalar_error_type("Acronym", value))
3333
return value
3434

3535
@staticmethod

api/schemas/organizations_mutations.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from functions.auth_functions import is_super_admin
1010
from functions.input_validators import cleanse_input
1111

12-
from model_enums.organiztions import OrganizationsEnum
13-
1412
from models import (
1513
Organizations,
1614
User_affiliations,

api/tests/test_auth_functions.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
1111
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
1212

13-
from manage import seed, remove_seed
14-
seed()
1513
from app import app
1614
from db import db
1715
from models import Users, User_affiliations, Organizations
@@ -21,7 +19,6 @@
2119
is_user_write,
2220
is_user_read
2321
)
24-
remove_seed()
2522

2623

2724
@pytest.fixture(scope='class')

api/tests/test_auth_wrapper.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
1515
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
1616

17-
from manage import seed, remove_seed
18-
seed()
1917
from app import app
2018
from db import db
2119
from queries import schema
2220
from models import Users, User_affiliations, Organizations
2321
from backend.security_check import SecurityAnalysisBackend
24-
remove_seed()
2522

2623

2724
@pytest.fixture(scope='class')

api/tests/test_cost_check.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
1717
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
1818

19-
from manage import seed, remove_seed
20-
seed()
2119
from db import db
2220
from app import app
2321
from queries import schema
2422
from models import Users
2523
from backend.security_check import SecurityAnalysisBackend
26-
remove_seed()
2724

2825

2926
@pytest.fixture(scope='class')

api/tests/test_depth_check.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
1717
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
1818

19-
from manage import seed, remove_seed
20-
seed()
2119
from app import app
2220
from db import db
2321
from queries import schema
2422
from models import Users
2523
from backend.security_check import SecurityAnalysisBackend
26-
remove_seed()
2724

2825

2926
@pytest.fixture(scope='class')

api/tests/test_domains_resolver_access_control.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,16 @@
1111

1212
from werkzeug.test import create_environ
1313

14-
from manage import seed, remove_seed
14+
# This is the only way I could get imports to work for unit testing.
15+
PACKAGE_PARENT = '..'
16+
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
17+
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
1518

16-
seed()
1719
from app import app
1820
from db import db
1921
from models import Organizations, Domains, Users, User_affiliations
2022
from queries import schema
2123
from backend.security_check import SecurityAnalysisBackend
22-
remove_seed()
23-
24-
# This is the only way I could get imports to work for unit testing.
25-
PACKAGE_PARENT = '..'
26-
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
27-
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
2824

2925

3026
@pytest.fixture(scope='class')

api/tests/test_notification_emails.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@
44

55
from graphene.test import Client
66

7+
# This is the only way I could get imports to work for unit testing.
8+
PACKAGE_PARENT = '..'
9+
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
10+
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
11+
712
from functions.email_templates import (
813
email_verification_template,
914
password_reset_template)
1015
from functions.error_messages import scalar_error_type
11-
from manage import seed, remove_seed
1216
from app import app
1317

14-
seed()
1518
from queries import schema
1619
from backend.security_check import SecurityAnalysisBackend
17-
remove_seed()
18-
19-
# This is the only way I could get imports to work for unit testing.
20-
PACKAGE_PARENT = '..'
21-
SCRIPT_DIR = dirname(realpath(join(os.getcwd(), expanduser(__file__))))
22-
sys.path.append(normpath(join(SCRIPT_DIR, PACKAGE_PARENT)))
2320

2421

2522
class TestPasswordReset:

0 commit comments

Comments
 (0)