def test_sort_rule(self, data, output, p_output): model = _search_model.PreparedSearchMixin() model.prepare_sort_rule(data) assert model.sort_rule == output assert model.prepared_sort_rule == p_output
def test_prepare_extensions(self, input, output, p_output): model = _search_model.PreparedSearchMixin() model.prepare_extension(input) assert model.extensions == output assert model.prepared_extension == p_output
def test_page(self, data): model = _search_model.PreparedSearchMixin() model.prepare_page(data) assert model.page == data assert model.prepared_page == data
def test_offset(self, data): model = _search_model.PreparedSearchMixin() model.prepare_offset(data) assert model.offset == data assert model.prepared_offset == data
def test_prepare_location(self, mocker, data, result, p_result): model = _search_model.PreparedSearchMixin() mocker.spy(_search_model, 'prepare_multi_locations') model.prepare_location(data) assert model.location == result assert model.prepared_location == p_result _search_model.prepare_multi_locations.assert_called_once_with(data)
def test_prepare_none_types(self, mocker): model = _search_model.PreparedSearchMixin() mocker.spy(_search_model, 'prepare_multi_pois') mocker.spy(_search_model, 'merge_multi_poi') model.prepare_types(None) assert model.types is None assert _search_model.prepare_multi_pois.call_count == 0 assert model.prepared_keywords is None assert _search_model.merge_multi_poi.call_count == 0
def test_prepare_types(self, mocker): model = _search_model.PreparedSearchMixin() mocker.spy(_search_model, 'prepare_multi_pois') mocker.spy(_search_model, 'merge_multi_poi') model.prepare_types(u'aaa|你') assert model.types == ['aaa', u'你'] _search_model.prepare_multi_pois.assert_called_once_with(u'aaa|你') assert model.prepared_types == u'aaa|你' _search_model.merge_multi_poi.assert_called_once_with(['aaa', u'你'])
def test_prepare_keywords(self, mocker): model = _search_model.PreparedSearchMixin() mocker.spy(_search_model, 'prepare_multi_address') mocker.spy(_search_model, 'merge_multi_address') model.prepare_keywords(u'aaa|你') assert model.keywords == ['aaa', u'你'] _search_model.prepare_multi_address.assert_called_once_with(u'aaa|你') assert model.prepared_keywords == u'aaa|你' _search_model.merge_multi_address.assert_called_once_with( ['aaa', u'你'])