15
15
run_items_transformer ,
16
16
_add_additional_info ,
17
17
_generate_item_notes ,
18
+ _set_withdrawn_note ,
18
19
_remove_on_order_items ,
19
20
)
20
21
@@ -35,6 +36,7 @@ def test_items_transformers():
35
36
{"id" : "e9f6de86-e564-4095-a61a-38c9e0e6b2fc" , "name" : "Tech Staff" },
36
37
{"id" : "62fd6fcc-5cde-4a74-849a-66e2d77a1f12" , "name" : "Public" },
37
38
{"id" : "1d14675c-c163-4502-98f9-961cd3d17ab2" , "name" : "Circ Staff" },
39
+ {"id" : "abeebfcc-53f9-4aea-ad80-561bebd99754" , "name" : "Withdrawn" },
38
40
]
39
41
}
40
42
@@ -92,7 +94,8 @@ def mock_get(*args, **kwargs):
92
94
"1233455\t a note\t CIRCSTAFF\n " ,
93
95
"1233455\t a note for the public\t CIRCNOTE\n " ,
94
96
"55678446243\t available for checkout\t PUBLIC\n " ,
95
- "55678446243\t tf:green, hbr 9/20/2013\t TECHSTAFF" ,
97
+ "55678446243\t tf:green, hbr 9/20/2013\t TECHSTAFF\n " ,
98
+ "8772580-1001\t At Hoover\t HVSHELFLOC" ,
96
99
]
97
100
98
101
items_recs = [
@@ -116,6 +119,10 @@ def mock_get(*args, **kwargs):
116
119
"holdingsRecordId" : "fc473c74-c811-4ae9-bcd9-387a1d10b967" ,
117
120
"barcode" : "0267132027" ,
118
121
},
122
+ {
123
+ "holdingsRecordId" : "a36e1aa4-e965-522a-8afb-dceac63f4206" ,
124
+ "barcode" : "8772580-1001" ,
125
+ },
119
126
]
120
127
121
128
items_tsv = [
@@ -125,6 +132,7 @@ def mock_get(*args, **kwargs):
125
132
"145623\t 1\t 1\t 4614642357\t SAL3\t SPECB-S\t INPROCESS\t STKS-MONO\t \t FED-WEED\t 0\t LC\t RH640 .I34 1996\t \t 0\t MARC\t 0" ,
126
133
"262345\t 1\t 1\t 7659908473\t SAL3\t INPROCESS\t INPROCESS\t STKS-MONO\t \t \t 1\t LC\t YU40 .J4 2096\t \t 0\t MARC\t 0" , # ITEM SHADOW
127
134
"5559991\t 1\t 1\t 7659908473\t SAL3\t INPROCESS\t INPROCESS\t STKS-MONO\t DIGI-SENT\t FED-WEED\t 0\t LC\t EG640 .J4 1796\t \t 1\t MARC\t 0" , # CALL SHADOW
135
+ "8772580\t 1\t 1\t 8772580-1001\t SUL\t STACKS\t WITHDRAWN\t STKS\t \t \t 0\t 1\t LC\t XX(8772580.1)\t 0\t MARC\t 0" ,
128
136
]
129
137
130
138
@@ -237,10 +245,11 @@ def test_add_additional_info(
237
245
assert "discoverySuppress" not in new_items_recs [1 ]
238
246
assert new_items_recs [2 ]["discoverySuppress" ] is True
239
247
assert new_items_recs [3 ]["discoverySuppress" ] is True
240
- assert new_items_recs [- 2 ]["statisticalCodeIds" ] == [
248
+ assert new_items_recs [- 3 ]["statisticalCodeIds" ] == [
241
249
"8be8d577-1cd7-4b84-ae71-d9472fc4d2b1" ,
242
250
"9c98fbcc-1728-41f5-9382-038d9fa45c0f" ,
243
251
]
252
+ assert new_items_recs [- 1 ]["notes" ][1 ]["note" ] == "Withdrawn in Symphony"
244
253
245
254
246
255
def test_add_additional_info_missing_barcode (
@@ -308,3 +317,11 @@ def test_remove_on_order_items(tmp_path):
308
317
_remove_on_order_items (source_path )
309
318
filtered_df = pd .read_csv (source_path , sep = "\t " )
310
319
assert len (filtered_df ) == 1
320
+
321
+
322
+ def test_set_withdrawn_note_no_prior_notes ():
323
+ item = {"barcode" : "295013344" }
324
+ item_lookups = {"295013344" : {"withdrawn?" : True }}
325
+ _set_withdrawn_note (item , item_lookups , item_note_types )
326
+ assert item ["notes" ][0 ]["note" ] == "Withdrawn in Symphony"
327
+ assert item ["notes" ][0 ]["type" ] == item_note_types .get ("Withdrawn" )
0 commit comments