File tree Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Expand file tree Collapse file tree 4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class DRFSettings(object):
55
66 def __init__ (self ):
77 self .drf_settings = {
8- "HIDDEN " : self .get_setting ("HIDDEN " ) or False
8+ "HIDE_DOCS " : self .get_setting ("HIDE_DOCS " ) or False
99 }
1010
1111 def get_setting (self , name ):
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class DRFDocsView(TemplateView):
1010
1111 def get_context_data (self , ** kwargs ):
1212 settings = DRFSettings ().settings
13- if settings ["HIDDEN " ]:
13+ if settings ["HIDE_DOCS " ]:
1414 raise Http404 ("Django Rest Framework Docs are hidden. Check your settings." )
1515
1616 context = super (DRFDocsView , self ).get_context_data (** kwargs )
Original file line number Diff line number Diff line change 3232ROOT_URLCONF = 'tests.urls'
3333
3434REST_FRAMEWORK_DOCS = {
35- 'HIDDEN ' : False
35+ 'HIDE_DOCS ' : False
3636}
3737
3838# Static files (CSS, JavaScript, Images)
Original file line number Diff line number Diff line change 66class DRFDocsViewTests (TestCase ):
77
88 SETTINGS_HIDE_DOCS = {
9- 'HIDDEN ' : True # Default: False
9+ 'HIDE_DOCS ' : True # Default: False
1010 }
1111
1212 def setUp (self ):
@@ -16,7 +16,7 @@ def test_settings_module(self):
1616
1717 settings = DRFSettings ()
1818
19- self .assertEqual (settings .get_setting ("HIDDEN " ), False )
19+ self .assertEqual (settings .get_setting ("HIDE_DOCS " ), False )
2020 self .assertEqual (settings .get_setting ("TEST" ), None )
2121
2222 def test_index_view_with_endpoints (self ):
@@ -52,8 +52,8 @@ def test_index_search_with_endpoints(self):
5252 @override_settings (REST_FRAMEWORK_DOCS = SETTINGS_HIDE_DOCS )
5353 def test_index_view_docs_hidden (self ):
5454 """
55- Should prevent the docs from loading the "HIDDEN " is set
56- to "False" in settings
55+ Should prevent the docs from loading the "HIDE_DOCS " is set
56+ to "True" or undefined under settings
5757 """
5858 response = self .client .get (reverse ('drfdocs' ))
5959
You can’t perform that action at this time.
0 commit comments