Skip to content

Commit 49f8088

Browse files
committed
new: Test for import/export
1 parent 2c9a6df commit 49f8088

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/testing_github.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,17 @@ def test_capture(self) -> None:
4646
uuid = self.github_instance.submit(url='https://rafiot.eu.pythonanywhere.com/redirect_http', quiet=True)
4747
self._wait_capture_done(uuid)
4848
response = self.github_instance.get_redirects(uuid)
49-
print(response)
5049
self.assertEqual('https://rafiot.eu.pythonanywhere.com/redirect_http', response['response']['url'])
5150
self.assertEqual('https://www.youtube.com/watch?v=iwGFalTRHDA', response['response']['redirects'][1])
5251

52+
# test export - import
53+
capture_export = self.github_instance.get_complete_capture(uuid)
54+
new_uuid, messages = self.github_instance.upload_capture(full_capture=capture_export, quiet=False)
55+
self.assertNotEqual(uuid, new_uuid)
56+
self.assertFalse(messages['errors'])
57+
self.assertEqual(len(messages['warnings']), 1)
58+
self.assertEqual(messages['warnings'][0], f'UUID {uuid} already exists, set a new one.')
59+
5360
def test_referer(self) -> None:
5461
uuid = self.github_instance.submit(url='https://rafiot.eu.pythonanywhere.com/referer', quiet=True)
5562
self._wait_capture_done(uuid)
@@ -123,10 +130,10 @@ def test_takedown_information(self) -> None:
123130
124131
uuid = self.github_instance.submit(url="https://www.circl.lu/", quiet=True)
125132
self._wait_capture_done(uuid)
126-
#get all takedown information
133+
# get all takedown information
127134
takedown_info = self.github_instance.get_takedown_information(capture_uuid=uuid)
128135
self.assertEqual(set(expected_takedown_info[0]), set(takedown_info[0]))
129-
#get only the filtered emails
136+
# get only the filtered emails
130137
filtered_mails = self.github_instance.get_takedown_information(capture_uuid=uuid, filter_contacts=True)
131138
self.assertEqual(set(expected_mails), set(filtered_mails))
132139

0 commit comments

Comments
 (0)