Пример #1
0
    def test_view_tenant_uses_tenant_template(self):
        tenant = Tenant()
        tenant.lastname = 'First tenant lastname'
        tenant.save()

        response = self.client.get('/tenants/' + str(tenant.id) + '/')
        self.assertTemplateUsed(response, 'tenant.html')
Пример #2
0
    def test_sending_and_reciving_tenants(self):
        first_tenant = Tenant()
        first_tenant.lastname = 'First tenant lastname'
        first_tenant.save()

        second_tenant = Tenant()
        second_tenant.lastname = 'Sec lastname'
        second_tenant.save()

        saved_tenants = Tenant.objects.all()
        self.assertEqual(saved_tenants.count(), 2)

        first_saved_tenant = saved_tenants[0]
        second_saved_tenant = saved_tenants[1]
        self.assertEqual(first_saved_tenant.lastname, 'First tenant lastname')
        self.assertEqual(second_saved_tenant.lastname, 'Sec lastname')