sul-dlss / common-accessioning

Suite of robots that handle the tasks of accessioning digital objects
Other
2 stars 1 forks source link

spec/lib/dor/text_extraction/file_fetcher_spec.rb: consider mocking HTTP request to pres cat, instead of preservation-client content retrieval method #1379

Open jmartin-sul opened 1 month ago

jmartin-sul commented 1 month ago

Can we mock the GET request that's ultimately being made in this test: https://github.com/sul-dlss/common-accessioning/blob/a45edb4c09159d1e864bd086184b532c12ececba/spec/lib/dor/text_extraction/file_fetcher_spec.rb#L29-L43

so that content and the on_data stuff could get exercised a slightly more natural/integration-y manner? Seems in principle like it should be straight-forward, so maybe worth 30-ish minutes of experimentation?

follow on from PR review: https://github.com/sul-dlss/common-accessioning/pull/1349/files/21fc07f6f19c9b5a7bfc3669f4d7522891b1db5e#diff-c0ea167b0c3e814c9391cef8720e8ee89460221bee8afdeb4b407e3506f8512b (wanted to get this merged and timebox this (possible) touchup)

(i originally suggested this because i was at first stumped at how the test can know on_data will get called exactly once, then realized it's because the pres client content method gets mocked by the current test, not that the mocking is terribly unrealistic, hence the suggestion to timebox and give up if difficult)