def create_new_project_submit(request): name = request.POST['name'] from project_actions import create_new_project create_new_project(name) return HttpResponse("New project creation done.")
def create(self, request): serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) project = create_new_project(serializer.validated_data["name"]) serializer2 = self.get_serializer(project) headers = self.get_success_headers(serializer2.data) return Response(serializer2.data, status=status.HTTP_201_CREATED, headers=headers)
def test_project_creation_and_removal(self): with P4Connection(self.P4HOST, self.P4PORT, self.P4USER) as p4: project = None try: project = create_new_project(self.PROJECT_NAME) delete_project(project) project = None except: if project: delete_project(project) raise
def test_project_creation_and_removal(self): with P4ConnectionAsUnitTestUser() as p4: project = None try: project = create_new_project(self.PROJECT_NAME) delete_project(project) project = None except: if project: delete_project(project) raise
def test_add_and_remove_user(self): with P4Connection(self.P4HOST, self.P4PORT, self.P4USER) as p4: project = None project_access = None try: project = create_new_project(self.PROJECT_NAME) project_access = add_user_to_project(project, self.user) remove_user_from_project(project_access) except: if project_access: remove_user_from_project(project_access) if project: delete_project(project) raise
def test_add_and_remove_user(self): with P4ConnectionAsUnitTestUser() as p4: project = None project_access = None try: project = create_new_project(self.PROJECT_NAME) project_access = add_user_to_project(project, self.user) remove_user_from_project(project_access) project_access = None delete_project(project) project = None except: if project_access: remove_user_from_project(project_access) if project: delete_project(project) raise