Bug 9845 - SIP tests : fix in 08checkin.t ("alert" field)
Summary: SIP tests : fix in 08checkin.t ("alert" field)
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: SIP2 (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Adrien SAURAT
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-19 14:16 UTC by Adrien SAURAT
Modified: 2020-12-02 10:58 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
proposed patch #1 (915 bytes, patch)
2013-03-19 14:22 UTC, Adrien SAURAT
Details | Diff | Splinter Review
proposed patch #2 (2.39 KB, patch)
2013-03-21 11:09 UTC, Adrien SAURAT
Details | Diff | Splinter Review
Bug 9845: SIP tests : fixes in 08checkin.t (2.45 KB, patch)
2013-06-28 07:58 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 9845: SIP tests : fixes in 08checkin.t (2.50 KB, patch)
2013-07-02 15:34 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Adrien SAURAT 2013-03-19 14:16:21 UTC
[MT10401]
An error occurs while trying the checkin SIP test, 08checkin.t:
08checkin.t ........... 4/5 
#   Failed test 'match leader Checkin: Item not checked out'
#   at /home/asaurat/workspace/versions/community/C4/SIP/t/SIPtest.pm line 204.
# Response '100YNY20130319    142702AOVIL|AB1783B|AQVIL|AJL ANGOISSE DU ROI SALOMON|CS362.6 AJA|AFItem not checked out|AY5AZE097' doesn't match pattern '(?-xism:^100YNN\d{8} {4}\d{6})'

We are trying to do a checkin operation on a document which is not checked out.
Koha sends a code 100, meaning "Checkin failed". As expected.
The three following characters are:
- resensitize
- magnetic media
- alert
And we have a difference on the "alert" character. Koha sends Y, and the test expects N.

Description of the "alert" field in the SIP2 documentation from 3M:
1-char, fixed-length field: Y or N. A Y in the alert field will generate an audible sound at the
SC. The alert will indicate conditions like articles on hold, articles belonging to another library
branch, or other alert conditions as determined by the ACS. The alert signal will alert the
library staff to special article handling conditions during discharging operations.

As we are testing a case where a problem is occuring (how could a patron check in if the item was not checked out?!), I actually think that the "alert" should be expected by the test, leading to a pattern like "^100YNY".
But maybe is this "alert" actually outside of the scope of this test, the important result being that the string begins with "100". Thus the checking pattern could be "^100YN[NY]".

I'll make a patch with the latest solution, but it's of course open to discussion, as I'm not 100% sure about how this test is supposed to react.
Comment 1 Adrien SAURAT 2013-03-19 14:22:42 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2013-03-20 13:54:52 UTC
I'm getting the same results pre and post patch.

$ perl -I.. 08checkin.t 
1..5
ok 1 - login
ok 2 - SC status
not ok 3 - match leader Checkin: prep: check out item (502326000005)
#   Failed test 'match leader Checkin: prep: check out item (502326000005)'
#   at SIPtest.pm line 204.
# Response '120NUN20130320    065359AOCPL|AA23529001000463|AB502326000005|AJ|AH|AFInvalid Item|BLY|AY3AZE7E3' doesn't match pattern '(?-xism:^121NNY\d{8} {4}\d{6})'
not ok 4 - match leader Checkin: Item (502326000005) is checked out
#   Failed test 'match leader Checkin: Item (502326000005) is checked out'
#   at SIPtest.pm line 204.
# Response '100NUY20130320    065359AOCPL|AB502326000005|CV99|AFItem not checked out|AY4AZEA99' doesn't match pattern '(?-xism:^101YNN\d{8} {4}\d{6})'
not ok 5 - match leader Checkin: Item not checked out
#   Failed test 'match leader Checkin: Item not checked out'
#   at SIPtest.pm line 204.
# Response '100NUY20130320    065359AOCPL|AB502326000005|CV99|AFItem not checked out|AY5AZEA98' doesn't match pattern '(?-xism:^100YN[NY]\d{8} {4}\d{6})'
# Looks like you failed 3 tests of 5.

Any idea as to what I'm doing wrong?
Comment 3 Adrien SAURAT 2013-03-20 14:57:26 UTC
Well, my patch is actually design to correct the test named 'match leader Checkin: Item not checked out', but your run seems to crash before that, on the test named 'match leader Checkin: prep: check out item'.

You have a response beginning with "120NUN" and the test expects "121NNY".
Two differences then, the main one being 120 instead of 121 (the checkin failed, and the AF field contains this message : Invalid Item.
Looks like your barcode is wrong or something like that ?!
Other difference, U instead of N for the "magnetic media" field.
I never encountered this U, and the unit test does not expect this, I don't know yet why you're getting this response.

From the 3M doc, about the "magnetic media" field:
1-char, fixed-length field: Y or N or U.
A 'Y' in this field indicates that this article is magnetic media and the SC will then handle the security discharge accordingly.
A 'N' in this field indicates that the article is not magnetic media.
A 'U' indicates that the ACS does not identify magnetic media articles. ACS vendors are encouraged to store and provide article magnetic media identification.

The following test which fails on your side is the direct consequence of the first fail. It's a checkout which can only success if the former checkin attempt succeeded.

On the last failing test, we are working on the test modified by my patch.
Here, you get :  100NUY
The test awaits: 100YN[NY]
Two fields make the test field:
- resensitize is on N for you (but should this make the test fail? after all, you can configure this in SIPconfig.xml for a reason)
- magnetic media, again you have U and I don't know why!! we should check the code for that.
Comment 4 Adrien SAURAT 2013-03-21 10:17:50 UTC
The differences seem to come from different values we have in ILS.pm (with the default file "magnetic media" => 1 but maybe you modified this?)

But anyway, it's in fact out of scope when it comes to testing a checkin.
A library could use magnetic media or not, choose to desensitize or not, what we are testing here is the ability to checkin, and that is proved by the third character, 0 or 1.

I'll thus make a patch allowing different configurations about magnetic madia.
Comment 5 Adrien SAURAT 2013-03-21 11:09:50 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2013-06-28 07:58:05 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall 2013-07-02 15:34:42 UTC
Created attachment 19352 [details] [review]
Bug 9845: SIP tests : fixes in 08checkin.t

The tests were too restrictive. It should be possible to pass
a checkin/checkout test with different values defined for
magnetic medias.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Passes koha-qa.pl, works as advertised.
Comment 8 Galen Charlton 2013-09-08 06:04:07 UTC
Pushed to master.  Thanks, Adrien!