def _set_ctx_project_cluster(self, request, project_id: str, cluster_id: str): from backend.container_service.clusters.base.models import CtxCluster from backend.container_service.projects.base.models import CtxProject access_token = 'access_token_for_test' request.ctx_project = CtxProject.create(token=access_token, id=project_id) if cluster_id: request.ctx_cluster = CtxCluster.create(token=access_token, id=cluster_id, project_id=project_id) else: request.ctx_cluster = None
def _set_ctx_project_cluster(self, request, project_id: str, cluster_id: str): access_token = request.user.token.access_token request.ctx_project = CtxProject.create(token=access_token, id=project_id) if cluster_id: request.ctx_cluster = CtxCluster.create(token=access_token, id=cluster_id, project_id=project_id) else: request.ctx_cluster = None
def test_comps(self, project_id): p = CtxProject.create(token='token', id=project_id) assert p.comps is not None
def test_failed_creation(self, project_id): with pytest.raises(TypeError): CtxProject(id=project_id)
def test_normal(self, project_id): p = CtxProject.create(token='token', id=project_id) assert p.context is not None assert p.id == project_id