Example #1
0
    def test_get_current_pipeline(self):
        CurrentPipeline.drop_collection()
        Project.drop_collection()
        User.drop_collection()

        user = User()
        user.username = "******"
        user.save()

        project = Project()
        project.user_id = user.id
        project.description = "Test project current pipeline"
        project.name = "Test project current pipeline"
        project.web_url = "https://currentpipeline.com"
        project.branches = ["branch1", "branch2"]
        project.save()

        currentpipeline = CurrentPipeline()
        currentpipeline.project = project
        currentpipeline.name = "Test current"
        currentpipeline.pipeline_jobs = [{"Teste": "Testando"}]
        currentpipeline.save()

        generalinfo = GeneralInformationPipelines()
        generalinfo.project = project
        generalinfo.number_of_pipelines = 10
        generalinfo.successful_pipelines = 5
        generalinfo.save()

        pipelines_in_db = CurrentPipeline.get_current_pipeline(project)
        for pipeline in pipelines_in_db:
            self.assertEqual(currentpipeline, pipeline)
Example #2
0
    def test_create_current_pipeline(self):
        CurrentPipeline.drop_collection()
        Project.drop_collection()
        User.drop_collection()

        user = User()
        user.username = "******"
        user.save()

        project = Project()
        project.user_id = user.id
        project.description = "Test project current pipeline"
        project.name = "Test project current pipeline"
        project.web_url = "https://currentpipeline.com"
        project.branches = ["branch1", "branch2"]
        project.save()

        current_pipeline = CurrentPipeline()
        name = "Test current"
        pipeline_jobs = [{"Teste": "Testando"}]
        current_pipeline.create_current_pipeline(name, pipeline_jobs, project)

        current_pipeline2 = CurrentPipeline.objects(name=name).first()

        self.assertEqual(current_pipeline, current_pipeline2)
Example #3
0
    def test_create_user(self):
        User.drop_collection()
        user = User()
        username = "******"
        user.create_user(username)

        user2 = User.objects(username=username).first()
        self.assertEqual(user, user2)
Example #4
0
    def test_save_gitlab_repo_data(self):
        User.drop_collection()
        user = User()
        username = "******"
        user.create_user(username)
        user.save()

        Project.drop_collection()
        project = Project()
        project.user_id = user.id
        project.description = "Test user add project"
        project.name = "Test user add project"
        project.web_url = "https://useraddProject.com"
        project.branches = ["branch1", "branch2"]
        project.save()

        user.save_gitlab_repo_data(project)

        project_user = User.objects(project=project).first()
        self.assertEqual(user, project_user)
Example #5
0
 def setup(self):
     super().setUp()
     User.drop_collection()
     Project.drop_collection()