Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmarticus committed Aug 7, 2024
1 parent 5183042 commit 5ee6560
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions posthog/test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,14 +487,14 @@ def test_base64_decode(self):
no_padding = "SGVsbG8sIFdvcmxkIQ"
self.assertEqual(base64_decode(no_padding), simple_string)

# Several tests with real URL encoded data
# from: https://posthog.sentry.io/issues/5680826999/
encoded_data = "eyJ0b2tlbiI6InBoY191eEl4QmhLQ2NVZll0d1NoTmhlRVMyNTJBak45b0pYNzZmcElybTV3cWpmIiwiZGlzdGluY3RfaWQiOiIwMTkxMjliNi1kNTQwLTczZjUtYjY3YS1kODI3MTEzOWFmYTYiLCJncm91cHMiOnt9fQ%3D%3D"
# Tests with real URL encoded data
# from: https://posthog.sentry.io/issues/5680826999/events/ee804fe6ffd148559180c61d7c822766/
encoded_data = b"data=eyJ0b2tlbiI6InBoY19HNEFGZkNtRWJXSXZXS05GWlVLaWhpNXRIaGNJU1FYd2xVYXpLMm5MdkE0IiwiZGlzdGluY3RfaWQiOiIwMTkxMmJjMS1iY2ZkLTcwNDYtOTQ0My0wNjVjZjhjYzUyYzUiLCJncm91cHMiOnt9fQ%3D%3D"
decoded = base64_decode(encoded_data)
decoded_json = json.loads(decoded)

self.assertEqual(decoded_json["token"], "phc_uxIxBhKCcUfYtwShNheES252AjN9oJX76fpIrm5wqjf")
self.assertEqual(decoded_json["distinct_id"], "019129b6-d540-73f5-b67a-d8271139afa6")
self.assertEqual(decoded_json["token"], "phc_G4AFfCmEbWIvWKNFZUKihi5tHhcISQXwlUazK2nLvA4")
self.assertEqual(decoded_json["distinct_id"], "01912bc1-bcfd-7046-9443-065cf8cc52c5")
self.assertEqual(decoded_json["groups"], {})

# from: https://posthog.sentry.io/issues/5680826999/events/2ec7bfd975594873a84ce8153388c6e2/
Expand Down

0 comments on commit 5ee6560

Please sign in to comment.