I have create two dict.
self.post_data={
'name' : 'Org 1',
'url' : 'http://www.org1.com',
'summary' : 'This is an example org1'
}
second
self.post_data1={
'name' : 'Org 2',
'url' : 'http://www.org2.com',
'summary' : 'This is an example org2'
}
Now my test_post_list function
def test_post_list(self):
self.create_session()
self.assertEqual(Org.objects.count(), 0)
self.assertHttpCreated(self.api_client.post('/members/api/v1/org/', format='json', data={self.post_data,self.post_data1}))
self.assertEqual(Org.objects.count(), 1)
if i pass data like this it raises an error
>ERROR: test_post_list (members.tests.test_org_resource.OrgTest)
Traceback (most recent call last):
File "C:\Users\Sanky\amber\members\tests\test_org_resource.py", line 51, in te st_post_list
self.assertHttpCreated(self.api_client.post('/members/api/v1/org/', format='
json', data={self.post_data,self.post_data1}))
TypeError: unhashable type: 'dict'`
how i pass list as data to test function..
Aucun commentaire:
Enregistrer un commentaire