Skip to content

Commit

Permalink
Refactored unit testing to speak to #263
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed Aug 11, 2021
1 parent 66817fc commit c2dae64
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 33 deletions.
69 changes: 37 additions & 32 deletions tests/test_cloud_connect_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,25 @@ def serviceCCAWS_InvalidPayloads(self):

return result

def serviceCCAWS_GetAWSSettings(self):
if falcon.GetAWSSettings()["status_code"] in AllowedResponses:
return True
else:
return False

def serviceCCAWS_QueryAWSAccounts(self):
if falcon.QueryAWSAccounts(parameters={"limit": 1})["status_code"] in AllowedResponses:
return True
else:
return False

def serviceCCAWS_GetAWSAccounts(self):
if falcon.GetAWSAccounts(ids=falcon.QueryAWSAccounts(
parameters={"limit": 1}
)["body"]["resources"][0]["id"])["status_code"] in AllowedResponses:
return True
else:
return False
# def serviceCCAWS_GetAWSSettings(self):
# if falcon.GetAWSSettings()["status_code"] in AllowedResponses:
# return True
# else:
# return False

# def serviceCCAWS_QueryAWSAccounts(self):
# if falcon.QueryAWSAccounts(parameters={"limit": 1})["status_code"] in AllowedResponses:
# return True
# else:
# return False

# def serviceCCAWS_GetAWSAccounts(self):
# if falcon.GetAWSAccounts(ids=falcon.QueryAWSAccounts(
# parameters={"limit": 1}
# )["body"]["resources"][0]["id"])["status_code"] in AllowedResponses:
# return True
# else:
# return False

def serviceCCAWS_GetAWSAccountsUsingList(self):
liste = []
Expand All @@ -125,17 +125,17 @@ def serviceCCAWS_AccountUpdate(self):
accountPayload["resources"][0]["external_id"] = orig_external_id
return False

def serviceCCAWS_AccountDelete(self):
if falcon.DeleteAWSAccounts(ids=accountPayload["resources"][0]["id"])["status_code"] in AllowedResponses:
return True
else:
return False
# def serviceCCAWS_AccountDelete(self):
# if falcon.DeleteAWSAccounts(ids=accountPayload["resources"][0]["id"])["status_code"] in AllowedResponses:
# return True
# else:
# return False

def serviceCCAWS_AccountRegister(self):
if falcon.ProvisionAWSAccounts(body=accountPayload)["status_code"] in AllowedResponses:
return True
else:
return False
# def serviceCCAWS_AccountRegister(self):
# if falcon.ProvisionAWSAccounts(body=accountPayload)["status_code"] in AllowedResponses:
# return True
# else:
# return False

def serviceCCAWS_VerifyAWSAccountAccess(self):
if falcon.VerifyAWSAccountAccess(
Expand Down Expand Up @@ -191,16 +191,18 @@ def serviceCCAWS_GenerateErrors(self):
return errorChecks

def test_GetAWSSettings(self):
assert self.serviceCCAWS_GetAWSSettings() is True
assert bool(falcon.GetAWSSettings()["status_code"] in AllowedResponses) is True

def test_QueryAWSAccounts(self):
assert self.serviceCCAWS_QueryAWSAccounts() is True
assert bool(falcon.QueryAWSAccounts(parameters={"limit": 1})["status_code"] in AllowedResponses) is True

@pytest.mark.skipif(falcon.QueryAWSAccounts(
parameters={"limit": 1}
)["status_code"] == 429, reason="API rate limit reached")
def test_GetAWSAccounts(self):
assert self.serviceCCAWS_GetAWSAccounts() is True
assert bool(falcon.GetAWSAccounts(ids=falcon.QueryAWSAccounts(
parameters={"limit": 1}
)["body"]["resources"][0]["id"])["status_code"] in AllowedResponses) is True

@pytest.mark.skipif(falcon.QueryAWSAccounts(
parameters={"limit": 1}
Expand All @@ -226,6 +228,9 @@ def test_InvalidPayloads(self):
def test_ForceAttributeError(self):
assert self.serviceCCAWS_ForceAttributeError() is True

def test_argument_vs_keyword(self):
assert bool(falcon.QueryAWSAccounts(5, limit=1)) is True

def test_Logout(self):
assert auth.serviceRevoke() is True

Expand Down
2 changes: 1 addition & 1 deletion tests/test_uber_api_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def uberCCAWS_TestUploadDownload(self):
response = falcon.command('UploadSampleV3', file_name=SOURCE, data=PAYLOAD, content_type="application/octet-stream")
try:
sha = response["body"]["resources"][0]["sha256"]
response = falcon.command("GetSampleV3", parameters={}, ids=sha)
response = falcon.command("GetSampleV3", ids=sha)
try:
open(TARGET, 'wb').write(response)
except TypeError:
Expand Down

0 comments on commit c2dae64

Please sign in to comment.