Ejemplo n.º 1
0
 def test_principal_cleanup_none(self):
     """Test that we can run a principal clean up on a tenant with no principals."""
     try:
         clean_tenant_principals(self.tenant)
     except Exception:
         self.fail(msg='clean_tenant_principals encountered an exception')
     with tenant_context(self.tenant):
         self.assertEqual(Principal.objects.count(), 0)
Ejemplo n.º 2
0
 def test_principal_cleanup_princpal_exists(self, mock_request):
     """Test that we can run a principal clean up on a tenant with an existing principal."""
     with tenant_context(self.tenant):
         self.principal = Principal(username='******')
         self.principal.save()
     try:
         clean_tenant_principals(self.tenant)
     except Exception:
         self.fail(msg='clean_tenant_principals encountered an exception')
     with tenant_context(self.tenant):
         self.assertEqual(Principal.objects.count(), 1)
Ejemplo n.º 3
0
 def test_principal_cleanup_princpal_error(self, mock_request):
     """Test that we can handle a principal clean up with an unexpected error from proxy."""
     with tenant_context(self.tenant):
         self.principal = Principal(username='******')
         self.principal.save()
     try:
         clean_tenant_principals(self.tenant)
     except Exception:
         self.fail(msg='clean_tenant_principals encountered an exception')
     with tenant_context(self.tenant):
         self.assertEqual(Principal.objects.count(), 1)
Ejemplo n.º 4
0
 def test_principal_cleanup_principal_not_in_group(self, mock_request):
     """Test that we can run a principal clean up on a tenant with a principal not in a group."""
     with tenant_context(self.tenant):
         self.principal = Principal(username="******")
         self.principal.save()
     try:
         clean_tenant_principals(self.tenant)
     except Exception:
         self.fail(msg="clean_tenant_principals encountered an exception")
     with tenant_context(self.tenant):
         self.assertEqual(Principal.objects.count(), 0)