def test_get_records_by_resource_id_and_status_no_records(self, mock_db_session, mock_get_timestamp, mock_model, mock_statusmodel): """Test that the function returns None when it got no records.""" my_connection = region_resource_id_status.Connection('url') self.assertIsNone(my_connection.get_records_by_resource_id_and_status('1', '2'))
def test_get_records_by_resource_id_sanity(self, mock_db_session, mock_get_timestamp, mock_model, mock_statusmodel): """No exception is raised when calling get_records_by_resource_id.""" my_connection = region_resource_id_status.Connection('url') my_connection.get_records_by_resource_id('test')
def test_get_records_by_filter_args_with_records(self, mock_db_session, mock_get_timestamp, mock_model, mock_statusmodel): """Test that the function returns None when it got records.""" my_connection = region_resource_id_status.Connection('url') my_connection.get_records_by_filter_args()
def test_add_update_status_record_duplicate_entry(self, mock_db_session): """No exception is raised when trying to add a duplicate entry.""" my_connection = region_resource_id_status.Connection('url') my_connection.add_update_status_record('timestamp', 'region', 'status', 'transaction_id', 'resource_id', 'ord_notifier', 'err_msg', 'delete', 'err_code')
def test_add_update_status_record_record_not_exist_sanity(self, mock_db_session): """Test that no exception is raised when calling add_update_status_record. where record does not exist """ my_connection = region_resource_id_status.Connection('url') my_connection.add_update_status_record('timestamp', 'region', 'status', 'transaction_id', 'resource_id', 'ord_notifier', 'err_msg', 'create', 'err_code')
def test_add_update_status_record_record_exist_sanity(self, mock_db_session): """Test that no exception is raised when calling add_update_status_record. where record exist """ my_connection = region_resource_id_status.Connection('url') my_connection.add_update_status_record('timestamp', 'region', 'status', 'transaction_id', 'resource_id', 'ord_notifier', 'err_msg', 'err_code', {"checksum": "1", "virtual_size": "2", "size": "3"})
def test_get_records_by_resource_id_and_status_with_records(self, mock_db_session, mock_get_timestamp, mock_model, mock_statusmodel): my_connection = region_resource_id_status.Connection('url') my_connection.get_records_by_resource_id_and_status('1', '2')
def test_get_timstamp_pair_sanity(self, db_session, time_mock, conf_mock): """Test get_timestamp_pair""" conf_mock.region_resource_id_status.max_interval_time.default = 1 my_connection = region_resource_id_status.Connection('url') (timestamp, ref_timestamp) = my_connection.get_timstamp_pair() self.assertEqual(timestamp, 80000)