Beispiel #1
0
 def test_1010(self, cn_client_v1_v2):
     """mock_api.listFormats() returns a populated objectFormatList"""
     mock_object_format_list.add_callback(
         d1_test.d1_test_case.MOCK_BASE_URL)
     object_format_list = cn_client_v1_v2.listFormats()
     assert len(object_format_list.objectFormat) == 100
     for object_format in object_format_list.objectFormat:
         assert object_format.formatId == 'format_id_0'
         break
 def _set_mock_session(self):
   # Must add Responses callbacks after activating @responses.activate
   mock_get.add_callback(d1_test.d1_test_case.MOCK_MN_BASE_URL)
   mock_list_nodes.add_callback(d1_test.d1_test_case.MOCK_CN_BASE_URL)
   mock_ping.add_callback(d1_test.d1_test_case.MOCK_MN_BASE_URL)
   mock_ping.add_callback(d1_test.d1_test_case.MOCK_CN_BASE_URL)
   mock_solr_search.add_callback(d1_test.d1_test_case.MOCK_CN_BASE_URL)
   mock_list_formats.add_callback(d1_test.d1_test_case.MOCK_CN_BASE_URL)
   mock_resolve.add_callback(d1_test.d1_test_case.MOCK_CN_BASE_URL)
   # Must set these session variables after activating Responses because
   # they implicitly call listNodes, etc.
   with d1_test.d1_test_case.mock_input('yes'):
     self.cp.get_session().set(
       session.CN_URL_NAME, d1_test.d1_test_case.MOCK_CN_BASE_URL
     )
     self.cp.get_session().set(
       session.MN_URL_NAME, d1_test.d1_test_case.MOCK_MN_BASE_URL
     )
Beispiel #3
0
 def test_1020(self, cn_client_v1_v2):
     """mock_api.listFormats(): Passing a trigger header triggers a DataONEException"""
     mock_object_format_list.add_callback(
         d1_test.d1_test_case.MOCK_BASE_URL)
     with pytest.raises(d1_common.types.exceptions.NotFound):
         cn_client_v1_v2.listFormats(vendorSpecific={'trigger': '404'})
Beispiel #4
0
 def test_1000(self, cn_client_v1_v2):
     """mock_api.listFormats() returns a objectFormatList PyXB object"""
     mock_object_format_list.add_callback(
         d1_test.d1_test_case.MOCK_BASE_URL)
     assert isinstance(cn_client_v1_v2.listFormats(),
                       cn_client_v1_v2.bindings.ObjectFormatList)