def test_non_str_endpoint_raises_error(self, *args): with self.assertRaisesRegex( exceptions.ApiClientConfigurationError, 'Endpoint URL is not a string, cannot create client' ): client.validate_client_args( [], 'username', 'password' )
def test_none_endpoint_raises_error(self, *args): with self.assertRaisesRegex( exceptions.ApiClientConfigurationError, 'Endpoint URL has not been set, cannot create client' ): client.validate_client_args( None, 'username', 'password' )
def test_non_str_password_raises_error(self, *args): with self.assertRaisesRegex( exceptions.ApiClientConfigurationError, 'Password is not a string, cannot create client' ): client.validate_client_args( 'https://endpoint/', 'username', [] )
def test_none_username_raises_error(self, *args): with self.assertRaisesRegex( exceptions.ApiClientConfigurationError, 'Username is not set, cannot create client' ): client.validate_client_args( 'https://endpoint/', None, 'password' )
def test_colon_in_password_raises_error(self, *args): with self.assertRaisesRegex( exceptions.ApiClientConfigurationError, 'Password contains ":" character \(illegal in basic auth\), ' 'cannot create client' ): client.validate_client_args( 'https://endpoint/', 'username', 'pass:word' )
def test_valid_args_returns_true(self, *args): self.assertTrue( client.validate_client_args( 'https://endpoint/', 'username', 'password' ) )