Download:
child 101:c9a81d64b0c3
parent 99:bb325f32083d
100:6b89941c4273
Anton Shestakov <av6@dwimlabs.net>, Tue, 19 Jul 2016 17:44:31 +0800
tests: use assertIn() for searching for an id in response

1 файлов изменено, 3 вставок(+), 2 удалений(-) [+]
test.py file | annotate | diff | comparison | revisions
--- a/test.py Tue Jul 19 14:55:13 2016 +0800
+++ b/test.py Tue Jul 19 17:44:31 2016 +0800
@@ -58,13 +58,14 @@
response = self.c.get(url)
data = json.loads(response.data)
- self.assertTrue(any(resource.get('_id', None) == resource_id for resource in data))
+ self.assertIn(resource_id, [resource['_id'] for resource in data])
url = self.all_url % self.workspace
response = self.c.get(url)
data = json.loads(response.data)
+ combined = chain(*data.values())
- self.assertTrue(any(resource.get('_id', None) == resource_id for resource in chain(*data.values())))
+ self.assertIn(resource_id, [resource['_id'] for resource in combined])
def update_resource(self, resource_id):
url = self.item_url % (self.workspace, resource_id)