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