def test_get_status_expired(self, active, expiration, start_end): active.return_value = 5 start_end.return_value = (datetime.datetime.now(), None) expiration.side_effect = stage.Error('Expired') self.assertEqual(stage.get_status(), 'Expired') self.assertTrue(expiration.called)
def test_get_status_complete(self, active, start_end): active.return_value = 5 start_end.return_value = (datetime.datetime.now(), datetime.datetime.now()) self.assertEqual(stage.get_status(), 'Complete')
def test_get_status_running(self, active, expiration, start_end): active.return_value = 5 start_end.return_value = (datetime.datetime.now(), None) self.assertEqual(stage.get_status(), 'Running') self.assertTrue(expiration.called)
def test_get_status_unknown(self, active): active.return_value = None self.assertEqual(stage.get_status(), 'Unknown')
def test_get_status_no_start(self, active, start_end): active.return_value = 4 start_end.return_value = (None, None) self.assertEqual(stage.get_status(), 'Unknown')