File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 132132
133133AUTH_USER_MODEL = 'api_user.User'
134134
135+ # ##################################################################### #
136+ # ################### REST FRAMEWORK ###################### #
137+ # ##################################################################### #
138+
135139REST_FRAMEWORK = {
136140 'DEFAULT_AUTHENTICATION_CLASSES' : (
137141 'api.authentication.backends.ActiveSessionAuthentication' ,
138142 ),
139143}
140144
145+ # ##################################################################### #
146+ # ################### CORS ############################### #
147+ # ##################################################################### #
148+
141149CORS_ALLOWED_ORIGINS = [
142150 "http://localhost:3000" ,
143151 "http://127.0.0.1:3000"
144152]
145153
154+ # ##################################################################### #
155+ # ################### TESTING ############################### #
156+ # ##################################################################### #
157+
158+ TESTING = False
159+ TEST_RUNNER = 'core.test_runner.CoreTestRunner'
Original file line number Diff line number Diff line change 1+ from importlib import import_module
2+
3+ from django .conf import settings
4+ from django .db import connections
5+ from django .test .runner import DiscoverRunner
6+
7+
8+ class CoreTestRunner (DiscoverRunner ):
9+ def setup_test_environment (self , ** kwargs ):
10+ """We set the TESTING setting to True. By default, it's on False."""
11+ super ().setup_test_environment (** kwargs )
12+ settings .TESTING = True
13+
14+ def setup_databases (self , ** kwargs ):
15+ """We set the database"""
16+ kwargs ['aliases' ] = connections
17+ r = super ().setup_databases (** kwargs )
18+ self .load_fixtures ()
19+ return r
20+
21+ @classmethod
22+ def load_fixtures (cls ):
23+ try :
24+ module = import_module (f'api.fixtures' )
25+ getattr (module , 'run_fixtures' )()
26+ except ImportError :
27+ return
You can’t perform that action at this time.
0 commit comments