2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 21:45:39 +00:00

Refactored Stock test to use fixtures

This commit is contained in:
Oliver Walters
2019-05-12 21:46:38 +10:00
parent 25e41b3fa2
commit f410957d8d
5 changed files with 142 additions and 63 deletions

View File

@ -1,12 +1,14 @@
# Create some fasteners
- model: part.part
pk: 1
fields:
name: 'M2x4 LPHS'
description: 'M2x4 low profile head screw'
category: 8
- model: part.part
pk: 2
fields:
name: 'M3x12 SHCS'
description: 'M3x12 socket head cap screw'
@ -15,6 +17,7 @@
# Create some resistors
- model: part.part
pk: 3
fields:
name: 'R_2K2_0805'
description: '2.2kOhm resistor in 0805 package'
@ -35,6 +38,7 @@
category: 3
- model: part.part
pk: 25
fields:
name: 'Widget'
description: 'A watchamacallit'

View File

@ -111,11 +111,11 @@ class CategoryTest(TestCase):
def test_default_locations(self):
""" Test traversal for default locations """
self.assertEqual(str(self.fasteners.default_location), 'Office/Drawer')
self.assertEqual(str(self.fasteners.default_location), 'Office/Drawer_1')
# Test that parts in this location return the same default location, too
for p in self.fasteners.children.all():
self.assert_equal(p.get_default_location(), 'Office/Drawer')
self.assert_equal(p.get_default_location(), 'Office/Drawer_1')
# Any part under electronics should default to 'Home'
R1 = Part.objects.get(name='R_2K2_0805')