import unittest from pyapd import objects class TestAPObjects(unittest.TestCase): def test_activity_from_json(self): act = objects.APObject.from_jsons('''{ "id": "http://example.org/123456", "type": "object" }''') self.assertIsInstance(act, objects.APObject) self.assertEqual(act.ap_id, 'http://example.org/123456') self.assertEqual(act.ap_type, 'object') def test_activity_to_json(self): act = objects.APObject( ap_id="http://example.org/123456", ap_type="object", ) data = act.to_jsons() self.assertIsInstance(data, str) self.assertIn('"id": "http://example.org/123456"', data)