def test_get_timestamp_db_errors(self, mock_get_ss_timestamp, mock_conn): """Test that get_timestamp() works.""" mock_get_ss_timestamp.side_effect = errors.MySQLError( 'snapshot_cycles', mock.MagicMock()) scanner.LOGGER = mock.MagicMock() actual = scanner._get_timestamp() self.assertEqual(1, scanner.LOGGER.error.call_count) self.assertIsNone(actual)
def test_get_timestamp(self, mock_get_ss_timestamp, mock_conn): """Test that get_timestamp() works.""" mock_get_ss_timestamp.return_value = self.fake_timestamp actual = scanner._get_timestamp() self.assertEqual(1, mock_get_ss_timestamp.call_count) self.assertEqual(self.fake_timestamp, actual)