|
| 1 | +import unittest |
| 2 | + |
| 3 | +from thepeer.main import ThePeerInit |
| 4 | + |
| 5 | + |
| 6 | +thepeer_test_suites = ThePeerInit("pssk_test_vwww1yvvpymamtut26x5tvpx1znrcmeis2k0kvcmwzjax") |
| 7 | + |
| 8 | + |
| 9 | +class ThePeerInitMethods(unittest.TestCase): |
| 10 | + def test_index_user(self): |
| 11 | + self.assertEqual.__self__.maxDiff = None |
| 12 | + self.assertEqual( |
| 13 | + thepeer_test_suites.index_user( |
| 14 | + "Osagie Iyayi", "iyayiemmanuel1@gmail.com", "iyayiemmanuel1@gmail.com" |
| 15 | + ), |
| 16 | + {"message": "identifier exists"}, |
| 17 | + ) |
| 18 | + |
| 19 | + def test_view_user(self): |
| 20 | + self.assertEqual.__self__.maxDiff = None |
| 21 | + self.assertEqual( |
| 22 | + thepeer_test_suites.view_user("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd"), |
| 23 | + { |
| 24 | + "indexed_user": { |
| 25 | + "name": "Osagie Iyayi", |
| 26 | + "identifier": "iyayiemmanuel1@gmail.com", |
| 27 | + "identifier_type": "email", |
| 28 | + "email": "iyayiemmanuel1@gmail.com", |
| 29 | + "reference": "3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd", |
| 30 | + "created_at": "2022-04-30T21:30:29.000000Z", |
| 31 | + "updated_at": "2022-05-04T07:37:45.000000Z", |
| 32 | + } |
| 33 | + }, |
| 34 | + ) |
| 35 | + |
| 36 | + def test_all_users(self): |
| 37 | + |
| 38 | + self.assertEqual( |
| 39 | + thepeer_test_suites.all_users(), |
| 40 | + { |
| 41 | + "indexed_users": { |
| 42 | + "data": [ |
| 43 | + { |
| 44 | + "name": "Osagie Iyayi", |
| 45 | + "identifier": "iyayiemmanuel1@gmail.com", |
| 46 | + "identifier_type": "email", |
| 47 | + "email": "iyayiemmanuel1@gmail.com", |
| 48 | + "reference": "3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd", |
| 49 | + "created_at": "2022-04-30T21:30:29.000000Z", |
| 50 | + "updated_at": "2022-05-04T07:37:45.000000Z", |
| 51 | + }, |
| 52 | + { |
| 53 | + "name": "Osagie Iyayi", |
| 54 | + "identifier": "iyayiemmanuel1@gmail.com", |
| 55 | + "identifier_type": "email", |
| 56 | + "email": "iyayiemmanuel1@gmail.com", |
| 57 | + "reference": "d2cb0c2c-7bd4-40a0-9744-824fbce176b7", |
| 58 | + "created_at": "2022-05-04T07:37:44.000000Z", |
| 59 | + "updated_at": "2022-05-04T07:37:44.000000Z", |
| 60 | + }, |
| 61 | + ], |
| 62 | + "meta": {"page": 1, "total": 2, "pageCount": 1, "perPage": 15}, |
| 63 | + } |
| 64 | + }, |
| 65 | + ) |
| 66 | + |
| 67 | + def test_user_links(self): |
| 68 | + self.assertEqual( |
| 69 | + thepeer_test_suites.get_user_links("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd"), |
| 70 | + {"links": []}, |
| 71 | + ) |
| 72 | + |
| 73 | + def test_single_link(self): |
| 74 | + self.assertEqual( |
| 75 | + thepeer_test_suites.get_single_link("3bbb0fbf-82fa-48a0-80eb-d2c0338fe7dd"), |
| 76 | + {"message": "link not found"}, |
| 77 | + ) |
0 commit comments