mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
Added better PartRelated creation test
This commit is contained in:
parent
de2b7e5daf
commit
32b46cdc2a
@ -5,7 +5,7 @@ from django.urls import reverse
|
|||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
|
|
||||||
from .models import Part
|
from .models import Part, PartRelated
|
||||||
|
|
||||||
|
|
||||||
class PartViewTestCase(TestCase):
|
class PartViewTestCase(TestCase):
|
||||||
@ -204,25 +204,18 @@ class PartTests(PartViewTestCase):
|
|||||||
class PartRelatedTests(PartViewTestCase):
|
class PartRelatedTests(PartViewTestCase):
|
||||||
|
|
||||||
def test_valid_create(self):
|
def test_valid_create(self):
|
||||||
""" test creation of an attachment for a valid part """
|
""" test creation of a related part """
|
||||||
|
|
||||||
response = self.client.get(reverse('part-related-create'), {'part': 1}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
response = self.client.get(reverse('part-related-create'), {'part': 1},
|
||||||
|
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
# TODO - Create a new attachment using this view
|
response = self.client.post(reverse('part-related-create'), {'part_1': 1, 'part_2': 2},
|
||||||
|
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
|
||||||
def test_invalid_create(self):
|
self.assertEqual(response.status_code, 200)
|
||||||
""" test creation of an attachment for an invalid part """
|
|
||||||
|
|
||||||
# TODO
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_edit(self):
|
|
||||||
""" test editing an attachment """
|
|
||||||
|
|
||||||
# TODO
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
n = PartRelated.objects.all().count()
|
||||||
|
self.assertEqual(n, 1)
|
||||||
|
|
||||||
class PartAttachmentTests(PartViewTestCase):
|
class PartAttachmentTests(PartViewTestCase):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user