Exemplo n.º 1
0
def test_elapsed_time():
    """Should return correct elapsed timestamp as a string"""
    dt = datetime.utcnow()
    ps = projects.ProjectStep()
    ps.start_time = dt
    ps.end_time = dt + timedelta(seconds=128.252525)
    result = ps.get_elapsed_timestamp()
    assert '02:08.25' == result
Exemplo n.º 2
0
def test_no_project_defaults():
    """
    A ProjectStep without a Project reference should properly default
    its properties and values
    """
    ps = projects.ProjectStep()
    assert -1 == ps.index
    assert [] == ps.web_includes
    assert ps.source_path is None
Exemplo n.º 3
0
    def test_no_project_defaults(self):
        """
        A ProjectStep without a Project reference should properly default
        its properties and values
        """

        ps = projects.ProjectStep()

        self.assertEqual(ps.index, -1)
        self.assertEqual(ps.web_includes, [])
        self.assertIsNone(ps.source_path)
Exemplo n.º 4
0
def test_is_dirty_branches():
    """
    ProjectStep should remain dirty until it has been properly
    initialized and run
    """
    ps = projects.ProjectStep()
    assert ps.is_dirty(), 'Expected to always starts dirty'

    ps._is_dirty = False
    assert ps.is_dirty(), 'Expected dirty because not modified is None'

    ps.last_modified = 1
    assert not ps.is_dirty(), 'Expected not dirty without valid source path'
Exemplo n.º 5
0
    def test_is_dirty_branches(self):
        """
        ProjectStep should remain dirty until it has been properly
        initialized and run
        """

        ps = projects.ProjectStep()

        self.assertTrue(ps.is_dirty(), 'always starts dirty')

        ps._is_dirty = False
        self.assertTrue(ps.is_dirty(), 'dirty because not modified is None')

        ps.last_modified = 1
        self.assertFalse(ps.is_dirty(), 'not dirty without a valid source path')