Skip to content

Commit

Permalink
new: Test for import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Jun 13, 2024
1 parent 2c9a6df commit 49f8088
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/testing_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ def test_capture(self) -> None:
uuid = self.github_instance.submit(url='https://rafiot.eu.pythonanywhere.com/redirect_http', quiet=True)
self._wait_capture_done(uuid)
response = self.github_instance.get_redirects(uuid)
print(response)
self.assertEqual('https://rafiot.eu.pythonanywhere.com/redirect_http', response['response']['url'])
self.assertEqual('https://www.youtube.com/watch?v=iwGFalTRHDA', response['response']['redirects'][1])

# test export - import
capture_export = self.github_instance.get_complete_capture(uuid)
new_uuid, messages = self.github_instance.upload_capture(full_capture=capture_export, quiet=False)
self.assertNotEqual(uuid, new_uuid)
self.assertFalse(messages['errors'])
self.assertEqual(len(messages['warnings']), 1)
self.assertEqual(messages['warnings'][0], f'UUID {uuid} already exists, set a new one.')

def test_referer(self) -> None:
uuid = self.github_instance.submit(url='https://rafiot.eu.pythonanywhere.com/referer', quiet=True)
self._wait_capture_done(uuid)
Expand Down Expand Up @@ -123,10 +130,10 @@ def test_takedown_information(self) -> None:
expected_mails = ['[email protected]', '[email protected]', '[email protected]']
uuid = self.github_instance.submit(url="https://www.circl.lu/", quiet=True)
self._wait_capture_done(uuid)
#get all takedown information
# get all takedown information
takedown_info = self.github_instance.get_takedown_information(capture_uuid=uuid)
self.assertEqual(set(expected_takedown_info[0]), set(takedown_info[0]))
#get only the filtered emails
# get only the filtered emails
filtered_mails = self.github_instance.get_takedown_information(capture_uuid=uuid, filter_contacts=True)
self.assertEqual(set(expected_mails), set(filtered_mails))

Expand Down

0 comments on commit 49f8088

Please sign in to comment.