예제 #1
0
    def test_configuration_check(self):
        settings.MULTITENANT_STATICFILES_DIRS = "tenants/%s/static"  # Not a list.
        finder = TenantFileSystemFinder()

        errors = finder.check()
        self.assertEqual(len(errors), 1)
        self.assertTrue(errors[0].is_serious())
예제 #2
0
    def test_configuration_check(self):
        settings.MULTITENANT_STATICFILES_DIRS = "tenants/%s/static"  # Not a list.
        finder = TenantFileSystemFinder()

        errors = finder.check()
        self.assertEqual(len(errors), 1)
        self.assertTrue(errors[0].is_serious())
예제 #3
0
    def test_storages_setter(self):
        finder = TenantFileSystemFinder()

        self.assertTrue(
            len(finder._storages) == 0,
            "Locations should not be initialized during construction",
        )
        finder.storages = "/test/path"
        self.assertEqual(finder._storages[self.tenant.schema_name], "/test/path")
예제 #4
0
    def test_storages_setter(self):
        finder = TenantFileSystemFinder()

        self.assertTrue(
            len(finder._storages) == 0,
            "Locations should not be initialized during construction",
        )
        finder.storages = "/test/path"
        self.assertEqual(finder._storages[self.tenant.schema_name], "/test/path")
예제 #5
0
    def test_storages_getter_after_connection_change(self):
        finder = TenantFileSystemFinder()
        finder.storages

        connection.schema_name = "another_test"
        finder.storages

        self.assertTrue(len(finder._storages) == 2)
        self.assertIn("another_test", finder._storages)
예제 #6
0
    def test_location_getter_after_connection_change(self):
        finder = TenantFileSystemFinder()
        locations = finder.locations

        connection.schema_name = "another_test"
        locations = finder.locations

        self.assertTrue(len(finder._locations) == 2)
        self.assertIn("another_test", finder._locations)
        self.assertEqual(locations[0][1], "tenants/another_test/static")
예제 #7
0
 def test_storages_getter_lazy_loading(self):
     finder = TenantFileSystemFinder()
     self.assertNotIn(
         self.tenant.schema_name,
         finder._storages,
         "Storages should not be initialized during construction.",
     )
     finder.storages
     self.assertIn(
         self.tenant.schema_name,
         finder._storages,
         "Lazy loading of storages failed!",
     )
예제 #8
0
 def test_location_getter_lazy_loading(self):
     finder = TenantFileSystemFinder()
     self.assertNotIn(
         self.tenant.schema_name,
         finder._locations,
         "Locations should not be initialized during construction.",
     )
     locations = finder.locations
     self.assertIn(
         self.tenant.schema_name,
         finder._locations,
         "Lazy loading of locations failed!",
     )
     self.assertEqual(locations[0][1], "tenants/test/static")
예제 #9
0
 def test_storages_getter_empty_after_init(self):
     finder = TenantFileSystemFinder()
     self.assertTrue(len(finder._storages) == 0)
예제 #10
0
 def test_location_getter_empty_after_init(self):
     finder = TenantFileSystemFinder()
     self.assertTrue(len(finder._locations) == 0)