-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Circulation Policies: Locate policy using item/patorn types pair
* FIX Returns only policies when pair exists in settings Signed-off-by: Aly Badr <aly.badr@rero.ch>
- Loading branch information
Aly Badr
committed
Mar 12, 2019
1 parent
267e183
commit 2288291
Showing
2 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of RERO ILS. | ||
# Copyright (C) 2017 RERO. | ||
# | ||
# RERO ILS is free software; you can redistribute it | ||
# and/or modify it under the terms of the GNU General Public License as | ||
# published by the Free Software Foundation; either version 2 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# RERO ILS is distributed in the hope that it will be | ||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with RERO ILS; if not, write to the | ||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
# MA 02111-1307, USA. | ||
# | ||
# In applying this license, RERO does not | ||
# waive the privileges and immunities granted to it by virtue of its status | ||
# as an Intergovernmental Organization or submit itself to any jurisdiction. | ||
|
||
"""CircPolicy Record tests.""" | ||
|
||
from __future__ import absolute_import, print_function | ||
|
||
from rero_ils.modules.circ_policies.api import CircPoliciesSearch, \ | ||
CircPolicy, circ_policy_id_fetcher | ||
|
||
|
||
def test_circ_policy_search( | ||
app, | ||
circ_policy, | ||
circ_policy_short, | ||
circ_policy_short_library | ||
): | ||
"""Test Find circ policy""" | ||
library_pid = 'lib1' | ||
patron_type_pid = 'ptty1' | ||
item_type_pid = 'itty1' | ||
cipo = CircPolicy.provide_circ_policy( | ||
library_pid, | ||
patron_type_pid, | ||
item_type_pid | ||
) | ||
assert cipo.pid == 'cipo2' | ||
# return library cipo when pair exists. | ||
library_pid = 'lib1' | ||
patron_type_pid = 'ptty2' | ||
item_type_pid = 'itty2' | ||
cipo = CircPolicy.provide_circ_policy( | ||
library_pid, | ||
patron_type_pid, | ||
item_type_pid | ||
) | ||
assert cipo.pid == 'cipo3' | ||
# return default cipo when pair does not exists. | ||
library_pid = 'lib2' | ||
patron_type_pid = 'ptty2' | ||
item_type_pid = 'itty2' | ||
cipo = CircPolicy.provide_circ_policy( | ||
library_pid, | ||
patron_type_pid, | ||
item_type_pid | ||
) | ||
assert cipo.pid == 'cipo1' | ||
# return default when pair is not set anywhere. | ||
library_pid = 'lib1' | ||
patron_type_pid = 'ptty3' | ||
item_type_pid = 'itty2' | ||
cipo = CircPolicy.provide_circ_policy( | ||
library_pid, | ||
patron_type_pid, | ||
item_type_pid | ||
) | ||
assert cipo.pid == 'cipo1' |