"""Tests for store logic.""" from oto import response import pytest from availability.logic import store STORE_ID = 42 @pytest.mark.parametrize( ['store_id', 'expected'], [ (STORE_ID, response.Response()), (STORE_ID + 1, response.create_not_found_response('Oops!')), (STORE_ID * 2, response.create_fatal_response('Boom!')), ] ) def test_get_store_by_id(store_id, expected, mocker): """Test get_store_by_id function. Assert that it calls appropriate model function with correct arguments and returns its result. """ model_mock = mocker.patch('availability.logic.store.store') model_mock.get_store_by_id.return_value = expected result = store.get_store_by_id(store_id) model_mock.get_store_by_id.assert_called_with(store_id) assert result == expected