Beispiel #1
0
    def test_global_resolve(self):
        """Testing if instantiating with default handle server'works
        and if a handle is correctly retrieved. """

        # Create instance with default server url:
        inst = RESTHandleClient(HTTPS_verify=self.https_verify)
        rec = inst.retrieve_handle_record_json(self.handle_global)

        self.assertIn('handle', rec,
            'Response lacks "handle".')
        self.assertIn('responseCode', rec,
            'Response lacks "responseCode".')
    def test_modify_handle_value_without_authentication(self):
        """Test if exception when not authenticated."""
        log_new_case("test_modify_handle_value_without_authentication")

        # Test variables
        testhandle = self.handle
        inst_readonly = RESTHandleClient(self.url,
                                         HTTPS_verify=self.https_verify)

        # Run code to be tested + check exception:
        log_start_test_code()
        with self.assertRaises(HandleAuthenticationError):
            inst_readonly.modify_handle_value(testhandle, foo='bar')
        log_end_test_code()
Beispiel #3
0
    def setUp(self):
        """ For most test, provide a client instance with the user-specified
        handle server url."""

        self.inst = RESTHandleClient(
            HTTPS_verify=self.https_verify,
            handle_server_url=self.url,
            url_extension_REST_API=self.path_to_api)

        # Before being able to run these tests without write access,
        # the handle that we use for testing must exist. With this code,
        # you can create it. You only need to create it once and leave it
        # on the server, it will not be modified and can be used eternally.
        if False:
            # This should always be false!!! Except for creating the
            # required handle once! 
            self.create_required_test_handles()
 def test_constructor_with_url(self):
     """Test constructor with one arg (ill-formatted server URL): No exception raised."""
     inst = RESTHandleClient('foo')
     self.assertIsInstance(inst, RESTHandleClient,
         'Not a client instance!')
 def test_constructor_no_args(self):
     """Test constructor without args: No exception raised."""
     inst = RESTHandleClient()
     self.assertIsInstance(inst, RESTHandleClient,
         'Not a client instance!')
 def setUp(self):
     self.inst = RESTHandleClient()
 def setUp(self):
     self.inst = RESTHandleClient()
     self.inst._RESTHandleClient__searcher._Searcher__has_search_access = True  # fake search access
     self.searcher = Searcher()
     self.searcher._Searcher__has_search_access = True  # Fake search access