parent
8f40162974
commit
07418a3ac3
31
api/tests/v1/test_api_create.py
Normal file
31
api/tests/v1/test_api_create.py
Normal file
@ -0,0 +1,31 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
|
||||
Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 27.01.22
|
||||
|
||||
"""
|
||||
from konova.settings import DEFAULT_GROUP
|
||||
from konova.tests.test_views import BaseTestCase
|
||||
|
||||
|
||||
class BaseAPIV1TestCase(BaseTestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
super().setUpTestData()
|
||||
|
||||
cls.superuser.get_API_token()
|
||||
cls.superuser.api_token.is_active = True
|
||||
cls.superuser.api_token.save()
|
||||
default_group = cls.groups.get(name=DEFAULT_GROUP)
|
||||
cls.superuser.groups.add(default_group)
|
||||
|
||||
cls.header_data = {
|
||||
"HTTP_ksptoken": cls.superuser.api_token.token,
|
||||
}
|
||||
|
||||
|
||||
class APIV1CreateTestCase(BaseAPIV1TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
super().setUpTestData()
|
@ -2,30 +2,16 @@ import json
|
||||
|
||||
from django.urls import reverse
|
||||
|
||||
from api.tests.v1.test_api_create import BaseAPIV1TestCase
|
||||
from konova.settings import DEFAULT_GROUP
|
||||
from konova.tests.test_views import BaseTestCase
|
||||
from konova.utils.user_checks import is_default_group_only
|
||||
|
||||
|
||||
class APIV1SharingTestCase(BaseTestCase):
|
||||
class APIV1SharingTestCase(BaseAPIV1TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
""" Creates a test file in memory for using in further tests
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
super().setUpTestData()
|
||||
cls.superuser.get_API_token()
|
||||
cls.superuser.api_token.is_active = True
|
||||
cls.superuser.api_token.save()
|
||||
default_group = cls.groups.get(name=DEFAULT_GROUP)
|
||||
cls.superuser.groups.add(default_group)
|
||||
|
||||
cls.header_data = {
|
||||
"HTTP_ksptoken": cls.superuser.api_token.token,
|
||||
}
|
||||
|
||||
def _run_share_request(self, url, user_list: list):
|
||||
data = {
|
||||
|
Loading…
Reference in New Issue
Block a user