Add assert to check the presence of random-incorrect-slug in the database.
@@ -28,7 +28,9 @@ class GoldViewTests(TestCase):
def test_incorrect_input_when_adding_projects(self):
self.assertEqual(self.golduser.projects.count(), 0)
- resp = self.client.post(reverse('gold_projects'), data={'project': 'random-incorrect-slug'})
+ incorrect_slug = 'xyz-random-incorrect-slug-xyz'
+ self.assertEqual(Project.objects.filter(slug=incorrect_slug).count(), 0)
+ resp = self.client.post(reverse('gold_projects'), data={'project': incorrect_slug})
self.assertFormError(resp, form='form', field='project', errors='No project found.')
def test_too_many_projects(self):
