Skip to content

Commit

Permalink
Added tests to make sure namespace is synced with project
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwang committed Feb 5, 2020
1 parent 352afd6 commit 34f6ecb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cloudman/projman/tests/test_project_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

from rest_framework import status

from helmsman.api import HelmsManAPI
from helmsman.api import HMServiceContext
from helmsman.api import NamespaceExistsException
from helmsman.tests import HelmsManServiceTestBase

Expand Down Expand Up @@ -113,6 +115,20 @@ def test_can_view_shared_project(self):
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT, response.data)
self._check_no_projects_exist()

def test_namespace_tied_to_project(self):
response = self._create_project()
# Namespace should be slugified version of project name
project_id = response.data['id']
namespace = response.data['namespace']
self.assertEquals(namespace, "gvl")
admin = User.objects.filter(is_superuser=True).first()
client = HelmsManAPI(HMServiceContext(user=admin))
obj = client.namespaces.get(namespace)
assert obj
self._delete_project(project_id)
obj = client.namespaces.get(namespace)
self.assertIsNone(obj, "Deleting the project should delete namespace")


class ProjectChartServiceTests(ProjManManServiceTestBase):

Expand Down

0 comments on commit 34f6ecb

Please sign in to comment.