Coming from Laravel background learning Django. Forgive me if my question is naive.
response = self.client.delete(reverse('details'), kwargs={'pk':pk}, format="json")
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
The above test passes, and I would like to go a little further and try to check if the database actually has this item, of course I can query the db and try to match the count. But in Laravel I have used these methods to check for the existence/nonexistence of records.
assertDatabaseHas('users', ['id' => 10]); //asserts true if record is present in users table.
assertDatabaseMissing('users', ['id' => 10]); // asserts true if record is not present in users table
Is there something similar present in Django?
Aucun commentaire:
Enregistrer un commentaire