def test_get_single_app_by_indexing_and_get(self): ds = MagicMock() ds.get_resource.return_value = { 'href': '/', 'offset': 2, 'limit': 25, 'items': [ {'href': 'test/resource'}, {'href': 'another/resource'} ] } rl = CollectionResource(client=MagicMock(data_store=ds), properties={ 'href': '/', 'offset': 0, 'limit': 25, 'items': [ {'href': 'test/resource'}, {'href': 'another/resource'} ] }) a = rl[0] b = rl['test/resource'] c = rl.get('another/resource') self.assertEqual(a.href, 'test/resource') self.assertEqual(b.href, 'test/resource') self.assertEqual(c.href, 'another/resource')
def test_get_single_app_by_indexing_and_get(self): ds = MagicMock() ds.get_resource.return_value = { 'href': '/', 'offset': 2, 'limit': 25, 'items': [{ 'href': 'test/resource' }, { 'href': 'another/resource' }] } rl = CollectionResource(client=MagicMock(data_store=ds), properties={ 'href': '/', 'offset': 0, 'limit': 25, 'items': [{ 'href': 'test/resource' }, { 'href': 'another/resource' }] }) a = rl[0] b = rl['test/resource'] c = rl.get('another/resource') self.assertEqual(a.href, 'test/resource') self.assertEqual(b.href, 'test/resource') self.assertEqual(c.href, 'another/resource')