From bd844547c7eacd2ab44cfda79bef499961a19fd5 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sat, 6 Apr 2019 16:17:06 +0200 Subject: Naive ActivityStream object --- tests/test_objects.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/test_objects.py (limited to 'tests') diff --git a/tests/test_objects.py b/tests/test_objects.py new file mode 100644 index 0000000..9646269 --- /dev/null +++ b/tests/test_objects.py @@ -0,0 +1,22 @@ +import unittest + +from pyapd import objects + + +class TestObjects(unittest.TestCase): + + def test_activity_from_json(self): + act = objects.ActivityObject.from_jsons('''{ + "id": "http://example.org/123456" + }''') + self.assertIsInstance(act, objects.ActivityObject) + self.assertEqual(act.id, 'http://example.org/123456') + + def test_activity_to_json(self): + act = objects.ActivityObject( + id="http://example.org/123456" + ) + data = act.to_jsons() + self.assertIsInstance(data, str) + self.assertIn('"id": "http://example.org/123456"', data) + -- cgit v1.2.3