aboutsummaryrefslogtreecommitdiff
path: root/tests/test_objects.py
blob: 452b4e7278dc5b87cfcc15a5552a465f34c7c2c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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.ap_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)