def test_refresh_tokens(self): """ Test refresh token operation """ local_uri = "http://localhost:{port}/".format(port=self.mock_server_port) ag = Agave(api_server=local_uri) ag.api_key = "xxx" ag.api_secret = "xxx" ag.refresh_token = "xxx" # See agavepy/agave.py:refresh_tokens() for more info. ag.created_at = str( int(time.time()) - 100 ) ag.expires_in = str(0) # Refresh access token ag.refresh_tokens() assert ag.token == "access token" assert ag.refresh_token == "refresh token"
def test_refresh_tokens(self): """ Test refresh token operation """ local_uri = "http://localhost:{port}/".format( port=self.mock_server_port) ag = Agave(api_server=local_uri) ag.api_key = "xxx" ag.api_secret = "xxx" ag.refresh_token = "xxx" # See agavepy/agave.py:refresh_tokens() for more info. ag.created_at = str(int(time.time()) - 100) ag.expires_in = str(0) # Refresh access token ag.refresh_tokens() assert ag.token == "access token" assert ag.refresh_token == "refresh token"
def test_get_access_token(self, mock_pass): """ Test access token creation Patch username and password from user to send a client create request to mock server. """ # Patch password prompt. mock_pass.return_value = "pass" # Instantiate Agave object making reference to local mock server. local_uri = "http://localhost:{port}/".format(port=self.mock_server_port) ag = Agave(api_server=local_uri, username="******") ag.api_key = "somekey" ag.api_secret = "somesecret" # Get access token. ag.get_access_token() assert ag.token == "access token" assert ag.refresh_token == "refresh token"
def test_get_access_token(self, mock_pass): """ Test access token creation Patch username and password from user to send a client create request to mock server. """ # Patch password prompt. mock_pass.return_value = "pass" # Instantiate Agave object making reference to local mock server. local_uri = "http://localhost:{port}/".format( port=self.mock_server_port) ag = Agave(api_server=local_uri, username="******") ag.api_key = "somekey" ag.api_secret = "somesecret" # Get access token. ag.get_access_token() assert ag.token == "access token" assert ag.refresh_token == "refresh token"
def test_client_delete(self, mock_input, mock_pass): """ Test clients_delete op Patch username and password from user to send a client create request to mock server. """ # Patch username and password. mock_input.return_value = "user" mock_pass.return_value = "pass" # Instantiate Agave object making reference to local mock server. local_uri = "http://localhost:{port}/".format( port=self.mock_server_port) ag = Agave(api_server=local_uri) ag.client_name = "client-name" ag.api_key = "some api key" ag.api_secret = "some secret" # Create client. ag.clients_delete() assert ag.api_key == "" assert ag.api_secret == ""