Skip to content

Commit 131c331

Browse files
committed
Update unit testing
1 parent 83633cb commit 131c331

4 files changed

Lines changed: 25 additions & 10 deletions

File tree

tests/test_authentications.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
_DEBUG = os.getenv("FALCONPY_UNIT_TEST_DEBUG", None)
2727
if _DEBUG:
2828
_DEBUG = True
29+
_MSSP = None
2930

3031

3132
class TestAuthentications:
@@ -107,7 +108,7 @@ def serviceAny_checkRegionNameLookups(self):
107108
base_url="usgov1", debug=_DEBUG
108109
)
109110
result = falcon.token()
110-
if result["status_code"] == 400:
111+
if result["status_code"] in [400, 403]:
111112
return True
112113
elif result["status_code"] == 429:
113114
pytest.skip("Rate limit hit")
@@ -362,4 +363,18 @@ def test_child_login_logout(self):
362363
failed_child_login = test_object.child_logout(login_as_parent=False)
363364
if not failed_child_login:
364365
_success = True
365-
assert _success
366+
assert _success
367+
368+
369+
def test_mssp_login(self):
370+
global _MSSP
371+
_success = False
372+
_MSSP = Hosts(client_id=auth.config["falcon_client_id"], client_secret=auth.config["falcon_client_secret"], debug=_DEBUG)
373+
if not _MSSP.child_login(member_cid="1234567890"):
374+
_success = True
375+
_MSSP.auth_object.creds["member_cid"] = "1234567890"
376+
assert(_success)
377+
378+
def test_mssp_logout(self):
379+
#_MSSP = Hosts(client_id=auth.config["falcon_client_id"], client_secret=auth.config["falcon_client_secret"], debug=_DEBUG)
380+
print(_MSSP.child_logout(login_as_parent=False))

tests/test_case_management.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,33 @@ def test_all_code_paths(self):
2626
"aggregates_file_details_post_v1": falcon.aggregates_file_details_post_v1(),
2727
"combined_file_details_get_v1": falcon.query_file_details(),
2828
"entities_file_details_get_v1": falcon.get_file_details(ids="1234567890"),
29-
#"entities_file_details_patch_v1": falcon.update_file_details(body={}),
29+
"entities_file_details_patch_v1": falcon.update_file_details(id="12345678"),
3030
"entities_files_bulk_download_post_v1": falcon.bulk_download_files(body={}),
3131
"entities_files_download_get_v1": falcon.download_existing_files(id="1234567890"),
3232
#"entities_files_upload_post_v1": falcon.CHECKTHIS_upload_file(),
3333
"entities_files_delete_v1": falcon.delete_file_details(ids="1234567890"),
3434
"queries_file_details_get_v1": falcon.query_file_detail_ids(),
35-
"aggregates_notification_groups_post_v1": falcon.get_notification_groups(body={}),
35+
"aggregates_notification_groups_post_v1": falcon.get_notification_groups(date_ranges={"from": "whenever", "to": "whenever"}),
3636
"aggregates_notification_groups_post_v2": falcon.get_notification_groups_v2(body={}),
3737
"aggregates_slas_post_v1": falcon.get_sla_aggregations(body={}),
3838
"aggregates_templates_post_v1": falcon.get_template_aggregations(body={}),
3939
"entities_fields_get_v1": falcon.get_fields(ids=["1234567890"]),
4040
"entities_notification_groups_get_v1": falcon.get_notification_groups(ids=["1234567890"]),
41-
"entities_notification_groups_post_v1": falcon.create_notification_group(body={}),
41+
"entities_notification_groups_post_v1": falcon.create_notification_group(name="whatever"),
4242
"entities_notification_groups_patch_v1": falcon.update_notification_group(body={}),
4343
"entities_notification_groups_delete_v1": falcon.delete_notification_group(ids=["1234567890"]),
4444
"entities_notification_groups_post_v2": falcon.create_notification_group_v2(body={}),
4545
"entities_notification_groups_patch_v2": falcon.update_notification_group_v2(body={}),
4646
"entities_notification_groups_delete_v2": falcon.delete_notification_group_v2(ids=["1234567890"]),
4747
"entities_slas_get_v1": falcon.get_slas(ids="1234567890"),
48-
"entities_slas_post_v1": falcon.create_sla(body={}),
48+
"entities_slas_post_v1": falcon.create_sla(description="whatever"),
4949
"entities_slas_patch_v1": falcon.update_sla(body={}),
5050
"entities_slas_delete_v1": falcon.delete_sla(ids="1234567890"),
5151
"entities_template_snapshots_get_v1": falcon.get_template_snapshots(template_ids="1234567890"),
5252
"entities_templates_export_get_v1": falcon.export_templates(ids="1234567890"),
5353
"entities_templates_import_post_v1": falcon.import_template(file="README.md"),
5454
"entities_templates_get_v1": falcon.get_templates(ids="1234567890"),
55-
"entities_templates_post_v1": falcon.create_template(body={}),
55+
"entities_templates_post_v1": falcon.create_template(description="whatever"),
5656
"entities_templates_patch_v1": falcon.update_template(body={}),
5757
"entities_templates_delete_v1": falcon.delete_templates(ids="1234567890"),
5858
"queries_fields_get_v1": falcon.query_fields(),
@@ -67,7 +67,7 @@ def test_all_code_paths(self):
6767
"entities_cases_put_v2": falcon.create_case(body={}),
6868
"entities_cases_post_v2": falcon.get_cases(ids="1234567890"),
6969
"entities_cases_patch_v2": falcon.update_case_fields(body={}),
70-
"entities_event_evidence_post_v1": falcon.add_case_event_evidence(body={}),
70+
"entities_event_evidence_post_v1": falcon.add_case_event_evidence(id="12345678"),
7171
"queries_cases_get_v1": falcon.query_case_ids()
7272
}
7373
for key in tests:

tests/test_cloud_azure_registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class TestCloudAzureRegistration:
8484
def test_all_code_paths(self):
8585
error_checks = True
8686
tests = {
87-
"cloud_registration_azure_delete_legacy_subscription": falcon.delete_legacy_subscription(body={}),
87+
"cloud_registration_azure_delete_legacy_subscription": falcon.delete_legacy_subscription(subscription_id="12345678"),
8888
"cloud_registration_azure_trigger_health_check": falcon.health_check(tenant_id="12345678"),
8989
"cloud_registration_azure_get_registration": falcon.get_registration(tenant_id="12345678"),
9090
"cloud_registration_azure_create_registration": falcon.create_registration(**AZURE_PAYLOAD["resource"]),

tests/test_downloads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
auth = Authorization.TestAuthorization()
1717
config = auth.getConfigObject()
1818
falcon = Downloads(auth_object=config)
19-
AllowedResponses = [200, 201, 207, 404, 429]
19+
AllowedResponses = [200, 201, 207, 403, 404, 429]
2020

2121
class TestDownloads:
2222
def test_all_code_paths(self):

0 commit comments

Comments
 (0)