Skip to content

Commit

Permalink
Use packit.dev to validate RequestResponseHandling
Browse files Browse the repository at this point in the history
Since example.com does not allow posts requests
anymore.
A 403 error is returned.
  • Loading branch information
majamassarini committed Sep 23, 2024
1 parent d428be7 commit e9de714
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_request_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,21 @@ def testRawCall(self):
"""
Test if is class is able to explicitly write and read request handling
"""
keys = [self.domain]
# example.com domain is not acceptig POST requests anymore
# using stg.packit.dev instead
keys = [
"https://stg.packit.dev/api/webhooks/github",
]
sess = RequestResponseHandling(store_keys=keys)
response = self.requests.post(*keys)
sess.write(response)

response_after = sess.read()
self.assertIsInstance(response_after, self.requests.models.Response)
self.assertNotIn("Example Domain", str(sess.get_cassette().storage_object))
self.assertIn("Example Domain", response_after.text)
self.assertNotIn(
"We haven't received any JSON data", str(sess.get_cassette().storage_object)
)
self.assertIn("We haven't received any JSON data", response_after.text)

@unittest.skipIf(not network_connection_available(), "No network connection")
def testExecuteWrapper(self):
Expand Down

0 comments on commit e9de714

Please sign in to comment.