mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Reorganize base TestCase classes
This commit is contained in:
@@ -7,7 +7,7 @@ from dcim.models import Site
|
||||
from extras.choices import *
|
||||
from extras.models import CustomField, ObjectChange, Tag
|
||||
from utilities.testing import APITestCase
|
||||
from utilities.testing.utils import post_data
|
||||
from utilities.testing.utils import create_tags, post_data
|
||||
from utilities.testing.views import ModelViewTestCase
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class ChangeLogViewTest(ModelViewTestCase):
|
||||
cf_select.content_types.set([ct])
|
||||
|
||||
def test_create_object(self):
|
||||
tags = self.create_tags('Tag 1', 'Tag 2')
|
||||
tags = create_tags('Tag 1', 'Tag 2')
|
||||
form_data = {
|
||||
'name': 'Site 1',
|
||||
'slug': 'site-1',
|
||||
@@ -72,7 +72,7 @@ class ChangeLogViewTest(ModelViewTestCase):
|
||||
def test_update_object(self):
|
||||
site = Site(name='Site 1', slug='site-1')
|
||||
site.save()
|
||||
tags = self.create_tags('Tag 1', 'Tag 2', 'Tag 3')
|
||||
tags = create_tags('Tag 1', 'Tag 2', 'Tag 3')
|
||||
site.tags.set('Tag 1', 'Tag 2')
|
||||
|
||||
form_data = {
|
||||
@@ -116,7 +116,7 @@ class ChangeLogViewTest(ModelViewTestCase):
|
||||
}
|
||||
)
|
||||
site.save()
|
||||
self.create_tags('Tag 1', 'Tag 2')
|
||||
create_tags('Tag 1', 'Tag 2')
|
||||
site.tags.set('Tag 1', 'Tag 2')
|
||||
|
||||
request = {
|
||||
|
@@ -2,7 +2,7 @@ from django.urls import reverse
|
||||
from rest_framework import status
|
||||
|
||||
from dcim.models import Site
|
||||
from utilities.testing import APITestCase
|
||||
from utilities.testing import APITestCase, create_tags
|
||||
|
||||
|
||||
class TaggedItemTest(APITestCase):
|
||||
@@ -10,7 +10,7 @@ class TaggedItemTest(APITestCase):
|
||||
Test the application of Tags to and item (a Site, for example) upon creation (POST) and modification (PATCH).
|
||||
"""
|
||||
def test_create_tagged_item(self):
|
||||
tags = self.create_tags("Foo", "Bar", "Baz")
|
||||
tags = create_tags("Foo", "Bar", "Baz")
|
||||
data = {
|
||||
'name': 'Test Site',
|
||||
'slug': 'test-site',
|
||||
@@ -37,7 +37,7 @@ class TaggedItemTest(APITestCase):
|
||||
slug='test-site'
|
||||
)
|
||||
site.tags.add("Foo", "Bar", "Baz")
|
||||
self.create_tags("New Tag")
|
||||
create_tags("New Tag")
|
||||
data = {
|
||||
'tags': [
|
||||
{"name": "Foo"},
|
||||
|
Reference in New Issue
Block a user