mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Unit test fixes
This commit is contained in:
parent
712c9598d1
commit
f67779c816
@ -15,8 +15,6 @@ from .validators import validate_overage, validate_part_name
|
||||
from . import helpers
|
||||
from . import version
|
||||
|
||||
from mptt.exceptions import InvalidMove
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
import InvenTree.tasks
|
||||
@ -203,7 +201,7 @@ class TestMPTT(TestCase):
|
||||
loc = StockLocation.objects.get(pk=4)
|
||||
loc.parent = loc
|
||||
|
||||
with self.assertRaises(InvalidMove):
|
||||
with self.assertRaises(ValidationError):
|
||||
loc.save()
|
||||
|
||||
def test_child_as_parent(self):
|
||||
@ -214,7 +212,7 @@ class TestMPTT(TestCase):
|
||||
|
||||
parent.parent = child
|
||||
|
||||
with self.assertRaises(InvalidMove):
|
||||
with self.assertRaises(ValidationError):
|
||||
parent.save()
|
||||
|
||||
def test_move(self):
|
||||
|
@ -44,6 +44,10 @@ class CompanyTest(InvenTreeAPITestCase):
|
||||
self.assertEqual(len(response.data), 2)
|
||||
|
||||
def test_company_detail(self):
|
||||
"""
|
||||
Tests for the Company detail endpoint
|
||||
"""
|
||||
|
||||
url = reverse('api-company-detail', kwargs={'pk': 1})
|
||||
response = self.get(url)
|
||||
|
||||
@ -52,14 +56,18 @@ class CompanyTest(InvenTreeAPITestCase):
|
||||
# Change the name of the company
|
||||
# Note we should not have the correct permissions (yet)
|
||||
data = response.data
|
||||
data['name'] = 'ACMOO'
|
||||
response = self.client.patch(url, data, format='json', expected_code=400)
|
||||
|
||||
self.assignRole('company.change')
|
||||
|
||||
# Update the name and set the currency to a valid value
|
||||
data['name'] = 'ACMOO'
|
||||
data['currency'] = 'NZD'
|
||||
|
||||
response = self.client.patch(url, data, format='json', expected_code=200)
|
||||
|
||||
self.assertEqual(response.data['name'], 'ACMOO')
|
||||
self.assertEqual(response.data['currency'], 'NZD')
|
||||
|
||||
def test_company_search(self):
|
||||
"""
|
||||
@ -182,6 +190,9 @@ class ManufacturerTest(InvenTreeAPITestCase):
|
||||
self.assertEqual(len(response.data), 2)
|
||||
|
||||
def test_manufacturer_part_detail(self):
|
||||
"""
|
||||
Tests for the ManufacturerPart detail endpoint
|
||||
"""
|
||||
url = reverse('api-manufacturer-part-detail', kwargs={'pk': 1})
|
||||
|
||||
response = self.get(url)
|
||||
|
Loading…
Reference in New Issue
Block a user