コード例 #1
0
 def test_has_sub_sections_should_return_false_if_backend_has_no_sections(
         self):
     backend = Backend()
     for s in backend.sections:
         s.sections = []
     backend_view = BackendView(backend, backend.sections, None, None)
     self.assertFalse(backend_view.has_sub_sections)
コード例 #2
0
 def test_get_url_for_model_should_return_none_if_model_not_found(self):
     backend_view = BackendView(self.backend, self.backend.sections, None,
                                None)
     self.assertIsNone(backend_view.get_url_for_model(User))
コード例 #3
0
 def test_get_url_for_model_should_return_backend_url_for_given_model(self):
     backend_view = BackendView(self.backend, self.backend.sections, None,
                                None)
     self.assertEqual('/admin/test-models/',
                      backend_view.get_url_for_model(TestModel))
コード例 #4
0
 def test_title_should_return_title_of_current_section_if_no_sub_section_is_available(
         self):
     section = self.backend.get_section_by_class(AccountBackendSection)
     backend_view = BackendView(self.backend, self.backend.sections,
                                section, None)
     self.assertEqual(section.title, backend_view.title)
コード例 #5
0
 def test_title_should_return_title_of_current_sub_section(self):
     section = self.backend.get_section_by_class(AccountBackendSection)
     subsection = section.get_section_by_class(AccountBackendSubSection)
     backend_view = BackendView(self.backend, self.backend.sections,
                                section, subsection)
     self.assertEqual(subsection.title, backend_view.title)
コード例 #6
0
 def test_current_sub_section_should_return_current_section_none(self):
     backend_view = BackendView(self.backend, self.backend.sections, None,
                                None)
     self.assertIsNone(backend_view.current_sub_section)
コード例 #7
0
 def test_current_section_should_return_current_section(self):
     section = self.backend.get_section_by_class(AccountBackendSection)
     backend_view = BackendView(self.backend, self.backend.sections,
                                section, None)
     self.assertEqual(section, backend_view.current_section)
コード例 #8
0
 def test_has_sub_sections_should_return_true_if_backend_has_sections(self):
     backend_view = BackendView(self.backend, self.backend.sections, None,
                                None)
     self.assertTrue(backend_view.has_sub_sections)
コード例 #9
0
 def test_sections_property_should_return_backend_sections(self):
     backend = Backend()
     backend_view = BackendView(backend, backend.sections, None, None)
     self.assertEqual(backend._sections, backend_view.sections)
     backend._sections = []
     self.assertEqual([], backend_view.sections)
コード例 #10
0
 def test_default_map_location_json_should_return_default_map_location_from_settings(
         self):
     backend_view = BackendView(self.backend, self.backend.sections, None,
                                None)
     self.assertEqual(to_json(settings.DEFAULT_MAP_LOCATION),
                      backend_view.default_map_location_json)
コード例 #11
0
 def test_url_property_should_return_backend_url(self):
     backend_view = BackendView(self.backend, self.backend.sections, None,
                                None)
     self.assertEqual('/admin/', backend_view.url)
コード例 #12
0
 def test_site_property_should_return_backend(self):
     backend_view = BackendView(self.backend, self.backend.sections, None,
                                None)
     self.assertEqual(self.backend, backend_view.site)