mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-17 20:45:44 +00:00
refactor test setup
This commit is contained in:
@ -4,7 +4,6 @@ from django.test import TestCase
|
||||
from django.conf import settings
|
||||
from django.urls import include, re_path, reverse
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import Group
|
||||
|
||||
from error_report.models import Error
|
||||
|
||||
@ -261,32 +260,8 @@ class PanelMixinTests(TestCase):
|
||||
'stock',
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
roles = ['all']
|
||||
|
||||
# Create a user which has all the privelages
|
||||
user = get_user_model()
|
||||
|
||||
self.user = user.objects.create_user(
|
||||
username='username',
|
||||
email='user@email.com',
|
||||
password='password'
|
||||
)
|
||||
|
||||
# Put the user into a group with the correct permissions
|
||||
group = Group.objects.create(name='mygroup')
|
||||
self.user.groups.add(group)
|
||||
|
||||
# Give the group *all* the permissions!
|
||||
for rule in group.rule_sets.all():
|
||||
rule.can_view = True
|
||||
rule.can_change = True
|
||||
rule.can_add = True
|
||||
rule.can_delete = True
|
||||
|
||||
rule.save()
|
||||
|
||||
self.client.login(username='username', password='password')
|
||||
|
||||
def test_installed(self):
|
||||
"""Test that the sample panel plugin is installed"""
|
||||
|
Reference in New Issue
Block a user