Archived
Refactors group tests
This commit is contained in:
1 parent
24446f10f0
commit
439131f95c
2 files changed
+26
-33
No files matched your search
+21
-4
@@ -4,7 +4,25 @@ import django
|
||||
from dusken.models import Member
|
||||
from tastypie.models import create_api_key
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
####################################################################
|
||||
### Request helper functions
|
||||
def do_get_request(self, url, creds):
|
||||
return self.api_client.get(
|
||||
url,
|
||||
format='json',
|
||||
authentication=creds
|
||||
)
|
||||
|
||||
def do_post_request(self, url, data, creds):
|
||||
return self.api_client.post(
|
||||
url,
|
||||
format='json',
|
||||
data=data,
|
||||
authentication=creds
|
||||
)
|
||||
|
||||
####################################################################
|
||||
### Fixture helper functions
|
||||
def test_fixtures():
|
||||
''' Returns a list with the locations of all defined fixtures. '''
|
||||
return [os.path.join('dusken', 'fixtures', 'country.json'),
|
||||
@@ -12,7 +30,6 @@ def test_fixtures():
|
||||
os.path.join('dusken', 'fixtures', 'institution.json'),
|
||||
]
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
def load_test_fixtures():
|
||||
''' Explicitly load all defined fixtures. This can be useful when
|
||||
you only want to load the fixtures for some testcases, but not
|
||||
@@ -20,7 +37,6 @@ def load_test_fixtures():
|
||||
for f in test_fixtures():
|
||||
call_command('loaddata', f, verbosity=0)
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
def test_fixtures_member():
|
||||
''' Returns a list with the locations of all defined fixtures. '''
|
||||
return [os.path.join('dusken', 'fixtures', 'address.json'),
|
||||
@@ -36,7 +52,8 @@ def test_fixtures_membership():
|
||||
os.path.join('dusken', 'fixtures', 'membershiptype.json'),
|
||||
os.path.join('dusken', 'fixtures', 'membership.json'),
|
||||
]
|
||||
|
||||
def load_test_fixtures_for_membership():
|
||||
django.db.models.signals.post_save.disconnect(create_api_key, sender=Member)
|
||||
for f in test_fixtures_membership():
|
||||
call_command('loaddata', f, verbosity=0)
|
||||
call_command('loaddata', f, verbosity=0)
|
||||
Reference in new issue
Block a user