mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Update test fixtures
- Can't assume that pk values will be assigned sensibly! - Need to hard-code them in
This commit is contained in:
@ -113,17 +113,17 @@ class ContactSimpleTest(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
# Create a simple company
|
||||
c = Company.objects.create(name='Test Corp.', description='We make stuff good')
|
||||
self.c = Company.objects.create(name='Test Corp.', description='We make stuff good')
|
||||
|
||||
# Add some contacts
|
||||
Contact.objects.create(name='Joe Smith', company=c)
|
||||
Contact.objects.create(name='Fred Smith', company=c)
|
||||
Contact.objects.create(name='Sally Smith', company=c)
|
||||
Contact.objects.create(name='Joe Smith', company=self.c)
|
||||
Contact.objects.create(name='Fred Smith', company=self.c)
|
||||
Contact.objects.create(name='Sally Smith', company=self.c)
|
||||
|
||||
def test_exists(self):
|
||||
self.assertEqual(Contact.objects.count(), 3)
|
||||
|
||||
def test_delete(self):
|
||||
# Remove the parent company
|
||||
Company.objects.get(pk=1).delete()
|
||||
Company.objects.get(pk=self.c.pk).delete()
|
||||
self.assertEqual(Contact.objects.count(), 0)
|
||||
|
Reference in New Issue
Block a user