Ejemplo n.º 1
0
    def test_edit_tenant(self):
        """
        when editing an existing tenant, all data should be kept
        """
        tenant = Tenant(domain_url='test.com', schema_name='test')
        tenant.save()

        # go to tenant's path
        connection.set_tenant(tenant)

        # add some data
        DummyModel(name="Schemas are").save()
        DummyModel(name="awesome!").save()

        # edit tenant
        tenant.domain_url = 'example.com'
        tenant.save()

        # test if data is still there
        self.assertEquals(DummyModel.objects.count(), 2)
Ejemplo n.º 2
0
    def test_edit_tenant(self):
        """
        when editing an existing tenant, all data should be kept
        """
        tenant = Tenant(domain_url='test.com', schema_name='test')
        tenant.save()

        # go to tenant's path
        connection.set_tenant(tenant)

        # add some data
        DummyModel(name="Schemas are").save()
        DummyModel(name="awesome!").save()

        # edit tenant
        tenant.domain_url = 'example.com'
        tenant.save()

        # test if data is still there
        self.assertEquals(DummyModel.objects.count(), 2)
Ejemplo n.º 3
0
    def test_sync_tenant(self):
        """
        When editing an existing tenant, all data should be kept.
        """
        tenant = Tenant(domain_url='something.test.com', schema_name='test')
        tenant.save(verbosity=BaseTestCase.get_verbosity())

        # go to tenant's path
        connection.set_tenant(tenant)

        # add some data
        DummyModel(name="Schemas are").save()
        DummyModel(name="awesome!").save()

        # edit tenant
        connection.set_schema_to_public()
        tenant.domain_url = 'example.com'
        tenant.save(verbosity=BaseTestCase.get_verbosity())

        connection.set_tenant(tenant)

        # test if data is still there
        self.assertEqual(DummyModel.objects.count(), 2)
Ejemplo n.º 4
0
    def test_sync_tenant(self):
        """
        When editing an existing tenant, all data should be kept.
        """
        tenant = Tenant(domain_url='something.test.com', schema_name='test')
        tenant.save(verbosity=BaseTestCase.get_verbosity())

        # go to tenant's path
        connection.set_tenant(tenant)

        # add some data
        DummyModel(name="Schemas are").save()
        DummyModel(name="awesome!").save()

        # edit tenant
        connection.set_schema_to_public()
        tenant.domain_url = 'example.com'
        tenant.save(verbosity=BaseTestCase.get_verbosity())

        connection.set_tenant(tenant)

        # test if data is still there
        self.assertEquals(DummyModel.objects.count(), 2)