From 9074f5812a4385f98a60a15db0669bfe24644993 Mon Sep 17 00:00:00 2001 From: regineheberlein Date: Mon, 12 Feb 2024 14:00:23 -0500 Subject: [PATCH] Stubbed alma holdings, delivery locations; added fixture for availability # Co-authored-by: Carolyn Cole git commit -m --- .../requests/requests_by_patron_group_spec.rb | 10 +- .../9994933183506421_22558528920006421.json | 22 +++ spec/fixtures/raw/9994933183506421.json | 129 ++++++++++++++++++ 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/availability/by_holding_id/9994933183506421_22558528920006421.json create mode 100644 spec/fixtures/raw/9994933183506421.json diff --git a/spec/features/requests/requests_by_patron_group_spec.rb b/spec/features/requests/requests_by_patron_group_spec.rb index 3347830e1..d60792e95 100644 --- a/spec/features/requests/requests_by_patron_group_spec.rb +++ b/spec/features/requests/requests_by_patron_group_spec.rb @@ -4,18 +4,26 @@ RSpec.shared_examples "can request", vcr: { cassette_name: 'request_features', record: :none } do let(:mms_id) { '9994933183506421?mfhd=22558528920006421' } let(:user) { FactoryBot.create(:user) } + let(:username) { "netid123" } before do login_as user + stub_alma_holding_locations + stub_single_holding_location("recap$pa") + stub_availability_by_holding_id(bib_id:"9994933183506421", holding_id:"22558528920006421", body: true) + stub_delivery_locations end + #failure message: Failure/Error: expect(page).to have_content 'Electronic Delivery' + #Failed to lookup your library account + it "PUL ReCAP print item" do stub_catalog_raw(bib_id: '9994933183506421') stub_scsb_availability(bib_id: "9994933183506421", institution_id: "PUL", barcode: '32101095798938') scsb_url = "#{Requests::Config[:scsb_base]}/requestItem/requestItem" stub_request(:post, scsb_url) .with(body: hash_including(author: "", bibId: "9994933183506421", callNumber: "PJ7962.A5495 A95 2016", chapterTitle: "", deliveryLocation: "PA", emailAddress: 'a@b.com', endPage: "", issue: "", itemBarcodes: ["32101095798938"], itemOwningInstitution: "PUL", patronBarcode: "22101008199999", - requestNotes: "", requestType: "RETRIEVAL", requestingInstitution: "PUL", startPage: "", titleIdentifier: "ʻAwāṭif madfūnah عواطف مدفونة", username: "jstudent", volume: "")) + requestNotes: "", requestType: "RETRIEVAL", requestingInstitution: "PUL", startPage: "", titleIdentifier: "ʻAwāṭif madfūnah عواطف مدفونة", username: username, volume: "")) .to_return(status: 200, body: good_response, headers: {}) stub_request(:post, Requests::Config[:scsb_base]) .with(headers: { 'Accept' => '*/*' }) diff --git a/spec/fixtures/availability/by_holding_id/9994933183506421_22558528920006421.json b/spec/fixtures/availability/by_holding_id/9994933183506421_22558528920006421.json new file mode 100644 index 000000000..e4f0d961c --- /dev/null +++ b/spec/fixtures/availability/by_holding_id/9994933183506421_22558528920006421.json @@ -0,0 +1,22 @@ +[ +{ +"barcode": "32101095798938", +"id": "23558528910006421", +"holding_id": "22558528920006421", +"copy_number": "0", +"status": "Available", +"status_label": "Item in place", +"status_source": "base_status", +"process_type": null, +"on_reserve": "N", +"item_type": "Gen", +"pickup_location_id": "recap", +"pickup_location_code": "recap", +"location": "recap$pa", +"label": "ReCAP - Remote Storage", +"description": "", +"enum_display": "", +"chron_display": "", +"in_temp_library": false +} +] \ No newline at end of file diff --git a/spec/fixtures/raw/9994933183506421.json b/spec/fixtures/raw/9994933183506421.json new file mode 100644 index 000000000..b4968ffa7 --- /dev/null +++ b/spec/fixtures/raw/9994933183506421.json @@ -0,0 +1,129 @@ +{ +"id": "9994933183506421", +"numeric_id_b": true, +"author_display": [ +"Samḥān, Najāt", +"سمحان، نجاة،" +], +"author_citation_display": [ +"Samḥān, Najāt" +], +"author_roles_1display": "{\"secondary_authors\":[\"سمحان، نجاة،\"],\"translators\":[],\"editors\":[],\"compilers\":[],\"primary_author\":\"Samḥān, Najāt\"}", +"author_s": [ +"Samḥān, Najāt", +"سمحان، نجاة،" +], +"marc_relator_display": [ +"Author" +], +"title_display": "ʻAwāṭif madfūnah / Najāt al-Samḥān.", +"title_vern_display": "عواطف مدفونة / نجاة السمحان.", +"title_t": [ +"ʻAwāṭif madfūnah / Najāt al-Samḥān." +], +"title_citation_display": [ +"ʻAwāṭif madfūnah", +"عواطف مدفونة" +], +"compiled_created_t": [ +"ʻAwāṭif madfūnah / Najāt al-Samḥān.", +"عواطف مدفونة / نجاة السمحان." +], +"pub_created_vern_display": [ +"القاهرة : دار الكتاب الحديث، 2016." +], +"pub_created_display": [ +"al-Qāhirah : Dār al-Kitāb al-Ḥadīth, 2016.", +"القاهرة : دار الكتاب الحديث، 2016." +], +"pub_created_s": [ +"al-Qāhirah : Dār al-Kitāb al-Ḥadīth, 2016.", +"القاهرة : دار الكتاب الحديث، 2016." +], +"pub_citation_display": [ +"al-Qāhirah: Dār al-Kitāb al-Ḥadīth", +"القاهرة: دار الكتاب الحديث،" +], +"pub_date_display": [ +"2016" +], +"pub_date_start_sort": 2016, +"cataloged_tdt": "2016-01-19T00:00:00Z", +"format": [ +"Book" +], +"description_display": [ +"230 pages ; 20 cm" +], +"description_t": [ +"230 pages ; 20 cm" +], +"number_of_pages_citation_display": [ +"230 pages" +], +"notes_display": [ +"Short stories." +], +"language_name_display": [ +"Arabic" +], +"language_facet": [ +"Arabic" +], +"language_iana_s": [ +"ar" +], +"lc_subject_display": [ +"Short stories, Arabic—21st century" +], +"subject_facet": [ +"Short stories, Arabic—21st century" +], +"isbn_display": [ +"9789773506827", +"9773506827" +], +"isbn_s": [ +"9789773506827" +], +"oclc_s": [ +"932335821" +], +"other_version_s": [ +"9789773506827", +"ocn932335821" +], +"subject_era_facet": [ +"21st century" +], +"holdings_1display": "{\"22558528920006421\":{\"location_code\":\"recap$pa\",\"location\":\"Remote Storage\",\"library\":\"ReCAP\",\"call_number\":\"PJ7962.A5495 A95 2016\",\"call_number_browse\":\"PJ7962.A5495 A95 2016\",\"items\":[{\"holding_id\":\"22558528920006421\",\"id\":\"23558528910006421\",\"status_at_load\":\"1\",\"barcode\":\"32101095798938\",\"copy_number\":\"0\"}]}}", +"location_code_s": [ +"recap$pa" +], +"location": [ +"ReCAP" +], +"location_display": [ +"Remote Storage" +], +"advanced_location_s": [ +"recap$pa", +"ReCAP" +], +"name_title_browse_s": [ +"Samḥān, Najāt. ʻAwāṭif madfūnah", +"سمحان، نجاة،. عواطف مدفونة" +], +"call_number_display": [ +"PJ7962.A5495 A95 2016" +], +"call_number_browse_s": [ +"PJ7962.A5495 A95 2016" +], +"call_number_locator_display": [ +"PJ7962.A5495 A95 2016" +], +"hashed_id_ssi": "fd5824304556cdcc", +"_version_": 1773889407970967600, +"timestamp": "2023-08-11T00:12:48.249Z" +} \ No newline at end of file