Пример #1
0
 def test_post_api_create(self, api):
     '''It should create a post from the API'''
     data = PostFactory.as_dict()
     data['datasets'] = [str(d.id) for d in data['datasets']]
     data['reuses'] = [str(r.id) for r in data['reuses']]
     api.login(AdminFactory())
     response = api.post(url_for('api.posts'), data)
     assert201(response)
     assert Post.objects.count() == 1
     post = Post.objects.first()
     for dataset, expected in zip(post.datasets, data['datasets']):
         assert str(dataset.id) == expected
     for reuse, expected in zip(post.reuses, data['reuses']):
         assert str(reuse.id) == expected
Пример #2
0
 def test_post_api_create(self):
     '''It should create a post from the API'''
     data = PostFactory.as_dict()
     data['datasets'] = [str(d.id) for d in data['datasets']]
     data['reuses'] = [str(r.id) for r in data['reuses']]
     self.login(AdminFactory())
     response = self.post(url_for('api.posts'), data)
     self.assert201(response)
     self.assertEqual(Post.objects.count(), 1)
     post = Post.objects.first()
     for dataset, expected in zip(post.datasets, data['datasets']):
         self.assertEqual(str(dataset.id), expected)
     for reuse, expected in zip(post.reuses, data['reuses']):
         self.assertEqual(str(reuse.id), expected)
Пример #3
0
 def test_post_api_create(self, api):
     '''It should create a post from the API'''
     data = PostFactory.as_dict()
     data['datasets'] = [str(d.id) for d in data['datasets']]
     data['reuses'] = [str(r.id) for r in data['reuses']]
     api.login(AdminFactory())
     response = api.post(url_for('api.posts'), data)
     assert201(response)
     assert Post.objects.count() == 1
     post = Post.objects.first()
     for dataset, expected in zip(post.datasets, data['datasets']):
         assert str(dataset.id) == expected
     for reuse, expected in zip(post.reuses, data['reuses']):
         assert str(reuse.id) == expected