Ejemplo n.º 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)
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)