Beispiel #1
0
    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
Beispiel #2
0
 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
Beispiel #3
0
 def test_comps(self, project_id):
     p = CtxProject.create(token='token', id=project_id)
     assert p.comps is not None
Beispiel #4
0
 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