def test_gap_timing_attribute_is_set_to_None(self):
     """testing if the gap_timing attribute value will be 0 when it is set
     to None
     """
     tdep = TaskDependency(**self.kwargs)
     tdep.gap_timing = None
     self.assertEqual(tdep.gap_timing, 0)
 def test_dependency_target_attribute_is_working_properly(self):
     """testing if the dependency_target attribute is working properly
     """
     tdep = TaskDependency(**self.kwargs)
     onstart = 'onstart'
     tdep.dependency_target = onstart
     self.assertEqual(onstart, tdep.dependency_target)
 def test_gap_timing_attribute_is_working_properly(self):
     """testing if the gap_timing attribute is working properly
     """
     tdep = TaskDependency(**self.kwargs)
     test_value = 11
     tdep.gap_timing = test_value
     self.assertEqual(tdep.gap_timing, test_value)
 def test_gap_unit_attribute_is_working_properly(self):
     """testing if the gap_unit attribute is working properly
     """
     tdep = TaskDependency(**self.kwargs)
     test_value = 'w'
     self.assertNotEqual(tdep.gap_unit, test_value)
     tdep.gap_unit = test_value
     self.assertEqual(tdep.gap_unit, test_value)
 def test_gap_model_attribute_is_None(self):
     """testing if the default value will be used when the gap_model
     attribute is set to None
     """
     tdep = TaskDependency(**self.kwargs)
     tdep.gap_model = None
     self.assertEqual(tdep.gap_model,
                      defaults.task_dependency_gap_models[0])
 def test_dependency_target_attribute_is_None(self):
     """testing if the default value will be used when the dependency_target
     attribute is set to None
     """
     tdep = TaskDependency(**self.kwargs)
     tdep.dependency_target = None
     self.assertEqual(tdep.dependency_target,
                      defaults.task_dependency_targets[0])
 def test_gap_unit_attribute_is_None(self):
     """testing if the default value will be used when the gap_unit
     attribute is set to None
     """
     tdep = TaskDependency(**self.kwargs)
     tdep.gap_unit = None
     self.assertEqual(tdep.gap_unit,
                      TaskDependency.__default_schedule_unit__)
 def test_gap_model_attribute_is_working_properly(self):
     """testing if the gap_model attribute is working properly
     """
     tdep = TaskDependency(**self.kwargs)
     test_value = 'duration'
     self.assertNotEqual(tdep.gap_model, test_value)
     tdep.gap_model = test_value
     self.assertEqual(tdep.gap_model, test_value)
Example #9
0
 def test_gap_unit_argument_is_None(self):
     """testing if the default value will be used when the gap_unit argument
     is None
     """
     from stalker import TaskDependency
     self.kwargs['gap_unit'] = None
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_unit == TaskDependency.__default_schedule_unit__
Example #10
0
 def test_gap_timing_argument_is_None(self):
     """testing if the gap_timing attribute value will be 0 when the
     gap_timing argument value is None
     """
     self.kwargs['gap_timing'] = None
     from stalker import TaskDependency
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_timing == 0
Example #11
0
 def test_gap_timing_argument_is_skipped(self):
     """testing if the gap_timing attribute value will be 0 when the
     gap_timing argument is skipped
     """
     self.kwargs.pop('gap_timing')
     from stalker import TaskDependency
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_timing == 0
Example #12
0
 def test_depends_to_argument_is_working_properly(self):
     """testing if the depends_to argument value is correctly passed to
     depends_to attribute
     """
     from stalker import TaskDependency
     self.test_task1.depends = []
     new_dep = TaskDependency(**self.kwargs)
     assert new_dep.depends_to == self.test_task2
Example #13
0
 def test_gap_model_argument_is_skipped(self):
     """testing if the default value will be used when the gap_model
     argument is skipped
     """
     from stalker import defaults, TaskDependency
     self.kwargs.pop('gap_model')
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_model == defaults.task_dependency_gap_models[0]
Example #14
0
 def test_dependency_target_argument_is_None(self):
     """testing if the default value will be used when the dependency_target
     argument is None
     """
     from stalker import defaults, TaskDependency
     self.kwargs['dependency_target'] = None
     tdep = TaskDependency(**self.kwargs)
     assert tdep.dependency_target == defaults.task_dependency_targets[0]
 def test_gap_model_argument_is_None(self):
     """testing if the default value will be used when the gap_model
     argument is None
     """
     self.kwargs['gap_model'] = None
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(tdep.gap_model,
                      defaults.task_dependency_gap_models[0])
 def test_gap_model_argument_is_skipped(self):
     """testing if the default value will be used when the gap_model
     argument is skipped
     """
     self.kwargs.pop('gap_model')
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(tdep.gap_model,
                      defaults.task_dependency_gap_models[0])
 def test_gap_unit_argument_is_None(self):
     """testing if the default value will be used when the gap_unit argument
     is None
     """
     self.kwargs['gap_unit'] = None
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(tdep.gap_unit,
                      TaskDependency.__default_schedule_unit__)
 def test_gap_unit_argument_is_skipped(self):
     """testing if the default value will be used when the gap_unit argument
     is skipped
     """
     self.kwargs.pop('gap_unit')
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(tdep.gap_unit,
                      TaskDependency.__default_schedule_unit__)
 def test_gap_timing_argument_is_working_properly(self):
     """testing if the gap_timing argument value is correctly passed to the
     gap_timing attribute
     """
     test_value = 11
     self.kwargs['gap_timing'] = test_value
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(tdep.gap_timing, test_value)
 def test_depends_to_argument_is_skipped_raises_error_on_commit(self):
     """testing if an Integrity error will be raised when the depends_to
     argument is skipped and the session is committed
     """
     self.kwargs.pop('depends_to')
     new_dependency = TaskDependency(**self.kwargs)
     DBSession.add(new_dependency)
     self.assertRaises(IntegrityError, DBSession.commit)
Example #21
0
 def test_gap_model_argument_is_None(self):
     """testing if the default value will be used when the gap_model
     argument is None
     """
     from stalker import defaults, TaskDependency
     self.kwargs['gap_model'] = None
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_model == defaults.task_dependency_gap_models[0]
 def test_dependency_target_argument_is_None(self):
     """testing if the default value will be used when the dependency_target
     argument is None
     """
     self.kwargs['dependency_target'] = None
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(tdep.dependency_target,
                      defaults.task_dependency_targets[0])
 def test_gap_model_argument_is_working_properly(self):
     """testing if the gap_model argument value is correctly passed to the
     gap_model attribute on init
     """
     test_value = 'duration'
     self.kwargs['gap_model'] = test_value
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(test_value, tdep.gap_model)
Example #24
0
 def test_dependency_target_argument_is_skipped(self):
     """testing if the default value will be used when the dependency_target
     argument is skipped
     """
     from stalker import defaults, TaskDependency
     self.kwargs.pop('dependency_target')
     tdep = TaskDependency(**self.kwargs)
     assert tdep.dependency_target == defaults.task_dependency_targets[0]
 def test_dependency_target_argument_is_skipped(self):
     """testing if the default value will be used when the dependency_target
     argument is skipped
     """
     self.kwargs.pop('dependency_target')
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(tdep.dependency_target,
                      defaults.task_dependency_targets[0])
Example #26
0
 def test_gap_unit_argument_is_skipped(self):
     """testing if the default value will be used when the gap_unit argument
     is skipped
     """
     from stalker import TaskDependency
     self.kwargs.pop('gap_unit')
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_unit == TaskDependency.__default_schedule_unit__
Example #27
0
 def test_gap_model_argument_is_working_properly(self):
     """testing if the gap_model argument value is correctly passed to the
     gap_model attribute on init
     """
     from stalker import TaskDependency
     test_value = 'duration'
     self.kwargs['gap_model'] = test_value
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_model == test_value
Example #28
0
 def test_gap_timing_argument_is_working_properly(self):
     """testing if the gap_timing argument value is correctly passed to the
     gap_timing attribute
     """
     from stalker import TaskDependency
     test_value = 11
     self.kwargs['gap_timing'] = test_value
     tdep = TaskDependency(**self.kwargs)
     assert tdep.gap_timing == test_value
 def test_gap_unit_argument_is_working_properly(self):
     """testing if the gap_unit argument value is correctly passed to the
     gap_unit attribute on init
     """
     from stalker import TaskDependency
     test_value = 'y'
     self.kwargs['gap_unit'] = test_value
     tdep = TaskDependency(**self.kwargs)
     self.assertEqual(test_value, tdep.gap_unit)
    def test_task_argument_is_not_a_task_instance(self):
        """testing if a TypeError will be raised when the task argument value
        is not a stalker.models.task.Task instance
        """
        self.kwargs['task'] = 'Not a Task instance'
        with self.assertRaises(TypeError) as cm:
            from stalker import TaskDependency
            TaskDependency(**self.kwargs)

        self.assertEqual(
            str(cm.exception), 'TaskDependency.task should be and instance of '
            'stalker.models.task.Task, not str')
Example #31
0
    def test_gap_model_argument_is_not_a_string_instance(self):
        """testing if a TypeError will be raised when the gap_model argument is
        not a string
        """
        from stalker import TaskDependency
        self.kwargs['gap_model'] = 231
        with pytest.raises(TypeError) as cm:
            TaskDependency(**self.kwargs)

        assert str(cm.value) == \
            "TaskDependency.gap_model should be one of ['length', " \
            "'duration'], not int"
Example #32
0
    def test_depends_to_argument_is_not_a_task_instance(self):
        """testing if a TypeError will be raised when the depends_to argument
        value is not a stalker.models.task.Task instance
        """
        self.kwargs['depends_to'] = 'Not a Task instance'
        from stalker import TaskDependency
        with pytest.raises(TypeError) as cm:
            TaskDependency(**self.kwargs)

        assert str(cm.value) == \
            'TaskDependency.depends_to can should be and instance of ' \
            'stalker.models.task.Task, not str'
Example #33
0
    def test_gap_model_argument_value_is_not_in_the_enum_list(self):
        """testing if a ValueError will be raised when the gap_model argument
        value is not one of ['duration', 'length']
        """
        from stalker import TaskDependency
        self.kwargs['gap_model'] = 'not in the list'
        with pytest.raises(ValueError) as cm:
            TaskDependency(**self.kwargs)

        assert str(cm.value) == \
            "TaskDependency.gap_model should be one of ['length', " \
            "'duration'], not str"
Example #34
0
    def test_dependency_target_argument_is_not_a_string_instance(self):
        """testing if a TypeError will be raised when the dependency_target
        argument is not a string
        """
        from stalker import TaskDependency
        self.kwargs['dependency_target'] = 0
        with pytest.raises(TypeError) as cm:
            TaskDependency(**self.kwargs)

        assert str(cm.value) == \
            "TaskDependency.dependency_target should be a string with a " \
            "value one of ['onend', 'onstart'], not int"
Example #35
0
    def test_dependency_target_argument_value_is_not_in_the_enum_list(self):
        """testing if a ValueError will be raised when the dependency_target
        argument value is not one of ['duration', 'length']
        """
        from stalker import TaskDependency
        self.kwargs['dependency_target'] = 'not in the list'
        with pytest.raises(ValueError) as cm:
            TaskDependency(**self.kwargs)

        assert str(cm.value) == \
            "TaskDependency.dependency_target should be one of ['onend', " \
            "'onstart'], not 'not in the list'"
    def test_dependency_target_argument_is_not_a_string_instance(self):
        """testing if a TypeError will be raised when the dependency_target
        argument is not a string
        """
        from stalker import TaskDependency
        self.kwargs['dependency_target'] = 0
        with self.assertRaises(TypeError) as cm:
            TaskDependency(**self.kwargs)

        self.assertEqual(
            str(cm.exception),
            "TaskDependency.dependency_target should be a string with a value "
            "one of ['onend', 'onstart'], not int")
Example #37
0
    def test_gap_unit_argument_is_not_a_string_instance(self):
        """testing if a TypeError will be raised when the gap_unit argument is
        not a string
        """
        from stalker import TaskDependency
        self.kwargs['gap_unit'] = 231
        with pytest.raises(TypeError) as cm:
            TaskDependency(**self.kwargs)

        assert str(cm.value) == \
            "TaskDependency.gap_unit should be a string value one of " \
            "['min', 'h', 'd', 'w', 'm', 'y'] showing the unit of the gap " \
            "timing of this TaskDependency, not int"
Example #38
0
    def test_gap_unit_argument_value_is_not_in_the_enum_list(self):
        """testing if a ValueError will be raised when the gap_unit argument
        value is not one of ['min', 'h', 'd', 'w', 'm', 'y']
        """
        from stalker import TaskDependency
        self.kwargs['gap_unit'] = 'not in the list'
        with pytest.raises(ValueError) as cm:
            TaskDependency(**self.kwargs)

        assert str(cm.value) == \
            "TaskDependency.gap_unit should be a string value one of " \
            "['min', 'h', 'd', 'w', 'm', 'y'] showing the unit of the gap " \
            "timing of this TaskDependency, not str"