Add JournalEntry tests

This commit is contained in:
Jeremy Stretch
2021-03-16 16:47:35 -04:00
parent 720f05976f
commit 9cba554ec9
5 changed files with 180 additions and 8 deletions

View File

@@ -3,12 +3,11 @@ import uuid
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.test import override_settings
from django.urls import reverse
from dcim.models import Site
from extras.choices import ObjectChangeActionChoices
from extras.models import ConfigContext, CustomLink, ObjectChange, Tag
from extras.models import ConfigContext, CustomLink, JournalEntry, ObjectChange, Tag
from utilities.testing import ViewTestCases, TestCase
@@ -128,6 +127,41 @@ class ObjectChangeTestCase(TestCase):
self.assertHttpStatus(response, 200)
class JournalEntryTestCase(
# ViewTestCases.GetObjectViewTestCase,
ViewTestCases.CreateObjectViewTestCase,
ViewTestCases.EditObjectViewTestCase,
ViewTestCases.DeleteObjectViewTestCase,
ViewTestCases.ListObjectsViewTestCase,
# ViewTestCases.BulkEditObjectsViewTestCase,
# ViewTestCases.BulkDeleteObjectsViewTestCase
):
model = JournalEntry
@classmethod
def setUpTestData(cls):
site_ct = ContentType.objects.get_for_model(Site)
site = Site.objects.create(name='Site 1', slug='site-1')
user = User.objects.create(username='User 1')
JournalEntry.objects.bulk_create((
JournalEntry(assigned_object=site, created_by=user, comments='First entry'),
JournalEntry(assigned_object=site, created_by=user, comments='Second entry'),
JournalEntry(assigned_object=site, created_by=user, comments='Third entry'),
))
cls.form_data = {
'assigned_object_type': site_ct.pk,
'assigned_object_id': site.pk,
'comments': 'A new entry',
}
cls.bulk_edit_data = {
'comments': 'Overwritten',
}
class CustomLinkTest(TestCase):
user_permissions = ['dcim.view_site']