Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
8naama committed Sep 11, 2024
1 parent 6037d48 commit c3d3866
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/UnitTests/test_azure_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ def test_valid_setup(self):
&grant_type=client_credentials
"""

expected_token_body2 = """client_id=some-client
&scope=https://outlook.office365.com/.default
&client_secret=some-secret
&grant_type=client_credentials
"""

# Validate the token request
self.assertEqual(ag.token_request.url, "https://login.microsoftonline.com/some-tenant/oauth2/v2.0/token")
self.assertEqual(am.token_request.url, "https://login.microsoftonline.com/some-tenant/oauth2/v2.0/token")
self.assertEqual(ag.token_request.body, expected_token_body)
self.assertEqual(am.token_request.body, expected_token_body)
self.assertEqual(am.token_request.body, expected_token_body2)

# Validate the data request URL was updated
self.assertIn("https://azure-graph?$filter=createdDateTime gt", ag.data_request.url)
Expand All @@ -64,7 +70,7 @@ def test_valid_setup(self):
self.assertEqual("https://azure-graph?$filter=createdDateTime gt {res.value.[0].createdDateTime}",
ag.data_request.next_url)
self.assertEqual(
"https://azure-mail?$filter=StartDate eq datetime '{res.d.results.[0].EndDate}' and EndDate eq datetime 'NOW_DATE'",
"https://azure-mail?$filter=StartDate eq datetime'{res.d.results.[0].EndDate}' and EndDate eq datetime'NOW_DATE'&$format=json",
am.data_request.next_url)

def test_start_date_generator(self):
Expand Down Expand Up @@ -159,4 +165,4 @@ def test_azure_mail_send_request(self):

self.assertEqual(result, data_res_body.get("d").get("results"))
self.assertEqual(a.data_request.url,
"https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTrace?$filter=StartDate eq datetime '2024-05-30T13:08:54Z' and EndDate eq datetime 'NOW_DATE'")
"https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MessageTrace?$filter=StartDate eq datetime'2024-05-30T13:08:54Z' and EndDate eq datetime'NOW_DATE'&$format=json")

0 comments on commit c3d3866

Please sign in to comment.