import unittest from pyapd import objects from pyapd.stores import memory, exceptions class TestMemoryStore(unittest.TestCase): def setUp(self): self.store = memory.Store() self.oid = 'https://test/object/12345' self.obj = objects.Object(ap_id=self.oid) self.store.add(self.obj) def test_add_object(self): oid = 'https://test/object/12345' obj = objects.Object(ap_id=oid) self.store.add(obj) self.assertIn(oid, self.store.objects) def test_get_object(self): res = self.store.get(self.oid) self.assertEqual(res, self.obj) def test_get_object_not_existing(self): oid = 'https://test/object/does_not_exist' with self.assertRaises(exceptions.DoesNotExist): self.store.get(oid)