"""Test for the flac file details model.""" from asset_file_details.models import flac_file_details \ as flac_file_details_model def test_get_flac_file_details_model(mocker): """Test getting the flac file details in the model.""" upc = 1234567890 audio_channels = 2 frequency = 44100 bits_per_sample = 16 filename = '1234567890_1_1.flac' md5_hash = '098f6bcd4621d373cade4e832627b4f6' initial_folder = 'WAV45/' folder_structure = '{upc(0,6)}/{upc(6,3)}/{upc}' test_keys_result = [ 'audio_channels', 'frequency', 'bits_per_sample', 'filename', 'md5_hash', 'initial_folder', 'folder_structure' ] test_fetchone_result = [ audio_channels, frequency, bits_per_sample, filename, md5_hash, initial_folder, folder_structure ] session_mock = mocker.Mock() execute_result_mock = mocker.Mock() execute_result_mock.keys.return_value = test_keys_result execute_result_mock.fetchone.return_value = test_fetchone_result session_mock.execute.return_value = execute_result_mock # a tuple containing the db column names and result row is expected expected_result = (test_keys_result, test_fetchone_result) result = flac_file_details_model.get_flac_file_details( upc, filename, session=session_mock) assert result == expected_result