lundi 16 octobre 2017

Test asc for arg which is self

Test should give 400 status code, but it ascs for self as argument, but isn't it a mistake? This is test:

def test_cab_number_does_not_exist(self):
    data = {"cab_number": "0"}
    self.client = self.Client
    url = reverse('api:orders')
    response = self.client.post(url, data)
    response_content = json.loads(response.content)
    cab_number = response_content['cab_number']
    self.assertEqual(response.status_code, 400)

This function gives mistake like: TypeError: test_cab_number_does_not_exist() takes exactly 1 argument (0 given) . I don't know how to fix it.

Aucun commentaire:

Enregistrer un commentaire