2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-30 18:50:53 +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:
Oliver Walters
2020-09-02 19:47:07 +10:00
parent bc2f131144
commit 911727f7b7
15 changed files with 85 additions and 57 deletions

View File

@ -2,6 +2,7 @@
# 4,000 screws in the dining room
- model: stock.stockitem
pk: 1
fields:
part: 1
location: 3
@ -14,6 +15,7 @@
# 5,000 screws in the bathroom
- model: stock.stockitem
pk: 2
fields:
part: 1
location: 2

View File

@ -1,4 +1,5 @@
- model: stock.stockitemtestresult
pk: 1
fields:
stock_item: 105
test: "Firmware Version"
@ -7,6 +8,7 @@
date: 2020-02-02
- model: stock.stockitemtestresult
pk: 2
fields:
stock_item: 105
test: "Settings Checksum"
@ -15,6 +17,7 @@
date: 2020-02-02
- model: stock.stockitemtestresult
pk: 3
fields:
stock_item: 105
test: "Temperature Test"
@ -23,6 +26,7 @@
notes: 'Got too hot or something'
- model: stock.stockitemtestresult
pk: 4
fields:
stock_item: 105
test: "Temperature Test"
@ -31,6 +35,7 @@
notes: 'Passed temperature test by making it cooler'
- model: stock.stockitemtestresult
pk: 5
fields:
stock_item: 522
test: 'applypaint'
@ -38,6 +43,7 @@
date: 2020-05-17
- model: stock.stockitemtestresult
pk: 6
fields:
stock_item: 522
test: 'applypaint'
@ -45,6 +51,7 @@
date: 2020-05-18
- model: stock.stockitemtestresult
pk: 7
fields:
stock_item: 522
test: 'Attach Legs'
@ -52,6 +59,7 @@
date: 2020-05-17
- model: stock.stockitemtestresult
pk: 8
fields:
stock_item: 522
test: 'Check that chair is GreEn '

View File

@ -21,7 +21,7 @@ class StockAPITestCase(APITestCase):
def setUp(self):
# Create a user for auth
User = get_user_model()
User.objects.create_user('testuser', 'test@testing.com', 'password')
self.user = User.objects.create_user('testuser', 'test@testing.com', 'password')
self.client.login(username='testuser', password='password')
def doPost(self, url, data={}):
@ -308,4 +308,4 @@ class StockTestResultTest(StockAPITestCase):
test = response.data[0]
self.assertEqual(test['value'], '150kPa')
self.assertEqual(test['user'], 1)
self.assertEqual(test['user'], self.user.pk)