def iiif_is_down_browse_type_elegant_fail(self): """ If the IIIF server is down, the code to get the browse type listing links should return an empty string. This will lead to the "are you sure you typed the right URL" message on the page. """ assert not DisplayBrowse.get_iiif_labels( CBrowseURL.mk_cbrowse_type_url_iiif(collection1, browse_type1), browse_type1, collection1, modify=Testing.bring_website_down, ) assert not DisplayBrowse.get_iiif_labels( CBrowseURL.mk_cbrowse_type_url_iiif(collection1, browse_type2), browse_type2, collection1, modify=Testing.bring_website_down, )
def browse_type_404(self): """ If there's a 404 error connecting to IIIF while getting the browse type JSON, the page should display a 'maybe you typed the wrong URL' message. In this case, that means the get_iiif_labels function should return an empty string. """ assert not DisplayBrowse.get_iiif_labels( CBrowseURL.mk_cbrowse_type_url_iiif(collection1, browse_type1), browse_type1, collection1, modify=Testing.change_status_code(404) ) assert not DisplayBrowse.get_iiif_labels( CBrowseURL.mk_cbrowse_type_url_iiif(collection1, browse_type2), browse_type2, collection1, modify=Testing.change_status_code(404) )
def browse_type_listing_works(self): """ Make sure we can pull the browse type links down from IIIF. """ iiif_url1 = CBrowseURL.mk_cbrowse_type_url_iiif( collection1, browse_type1) iiif_url2 = CBrowseURL.mk_cbrowse_type_url_iiif( collection1, browse_type2) assert DisplayBrowse.get_iiif_labels( iiif_url1, browse_type1, collection1, ) assert DisplayBrowse.get_iiif_labels( iiif_url2, browse_type2, collection1, )