Ejemplo n.º 1
0
 def test_projects_attribute_is_set_to_None(self):
     """testing if the projects attribute will be an empty list if it is set
     to None
     """
     tjp_sched = TaskJugglerScheduler(compute_resources=True)
     tjp_sched.projects = None
     self.assertEqual(tjp_sched.projects, [])
 def test_projects_attribute_is_set_to_None(self):
     """testing if the projects attribute will be an empty list if it is set
     to None
     """
     tjp_sched = TaskJugglerScheduler(compute_resources=True)
     tjp_sched.projects = None
     self.assertEqual(tjp_sched.projects, [])
Ejemplo n.º 3
0
    def test_projects_attribute_is_not_list_of_all_projects(self):
        """testing if a TypeError will be raised when the elements in the
        projects attribute is not all Project instances
        """
        tjp = TaskJugglerScheduler(compute_resources=True)
        with pytest.raises(TypeError) as cm:
            tjp.projects = ['not', 1, [], 'of', 'projects']

        assert str(cm.value) == \
            'TaskJugglerScheduler.projects should be a list of ' \
            'stalker.models.project.Project instances, not str'
Ejemplo n.º 4
0
    def test_projects_attribute_is_not_a_list(self):
        """testing if a TypeError will be raised when the projects attribute
        is set to something else than a list
        """
        tjp = TaskJugglerScheduler(compute_resources=True)
        with pytest.raises(TypeError) as cm:
            tjp.projects = 'not a list of projects'

        assert str(cm.value) == \
            'TaskJugglerScheduler.projects should be a list of ' \
            'stalker.models.project.Project instances, not str'
Ejemplo n.º 5
0
    def test_projects_attribute_is_working_properly(self):
        """testing if the projects attribute is working properly
        """
        dp1 = Project(name="Dummy Project", code="DP", repository=self.test_repo)

        dp2 = Project(name="Dummy Project", code="DP", repository=self.test_repo)

        tjp = TaskJugglerScheduler(compute_resources=True)
        tjp.projects = [dp1, dp2]

        self.assertEqual(tjp.projects, [dp1, dp2])
Ejemplo n.º 6
0
    def test_projects_attribute_is_not_list_of_all_projects(self):
        """testing if a TypeError will be raised when the elements in the
        projects attribute is not all Project instances
        """
        tjp = TaskJugglerScheduler(compute_resources=True)
        with self.assertRaises(TypeError) as cm:
            tjp.projects = ["not", 1, [], "of", "projects"]

        self.assertEqual(
            str(cm.exception),
            "TaskJugglerScheduler.projects should be a list of " "stalker.models.project.Project instances, not str",
        )
Ejemplo n.º 7
0
    def test_projects_attribute_is_not_a_list(self):
        """testing if a TypeError will be raised when the projects attribute
        is set to something else than a list
        """
        tjp = TaskJugglerScheduler(compute_resources=True)
        with self.assertRaises(TypeError) as cm:
            tjp.projects = "not a list of projects"

        self.assertEqual(
            str(cm.exception),
            "TaskJugglerScheduler.projects should be a list of " "stalker.models.project.Project instances, not str",
        )
    def test_projects_attribute_is_working_properly(self):
        """testing if the projects attribute is working properly
        """
        dp1 = Project(name='Dummy Project',
                      code='DP',
                      repository=self.test_repo)

        dp2 = Project(name='Dummy Project',
                      code='DP',
                      repository=self.test_repo)

        tjp = TaskJugglerScheduler(compute_resources=True)
        tjp.projects = [dp1, dp2]

        self.assertEqual(tjp.projects, [dp1, dp2])
Ejemplo n.º 9
0
    def test_tjp_file_is_created(self):
        """testing if the tjp file is correctly created
        """
        # create the scheduler
        tjp_sched = TaskJugglerScheduler()
        tjp_sched.projects = [self.test_proj1]

        tjp_sched._create_tjp_file()
        tjp_sched._create_tjp_file_content()
        tjp_sched._fill_tjp_file()

        # check
        self.assertTrue(os.path.exists(tjp_sched.tjp_file_full_path))

        # clean up the test
        tjp_sched._clean_up()
    def test_tjp_file_is_created(self):
        """testing if the tjp file is correctly created
        """
        # create the scheduler
        tjp_sched = TaskJugglerScheduler()
        tjp_sched.projects = [self.test_proj1]

        tjp_sched._create_tjp_file()
        tjp_sched._create_tjp_file_content()
        tjp_sched._fill_tjp_file()

        # check
        self.assertTrue(os.path.exists(tjp_sched.tjp_file_full_path))

        # clean up the test
        tjp_sched._clean_up()