Skip to content

Commit

Permalink
Ensure test fails with new NGROK_API_KEY implementation checking the …
Browse files Browse the repository at this point in the history
…negative case.
  • Loading branch information
alexdlaird committed Jan 4, 2025
1 parent f98b91d commit 69f0ea7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyngrok/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def set_api_key(pyngrok_config: PyngrokConfig,
:raises: :class:`~pyngrok.exception.PyngrokNgrokError`: When ``ngrok`` could not start.
"""
if pyngrok_config.ngrok_version == "v2":
raise PyngrokError(f"\"ngrok_version\" v2 does not have this command.")
raise PyngrokError("\"ngrok_version\" v2 does not have this command.")
elif pyngrok_config.ngrok_version == "v3":
start = [pyngrok_config.ngrok_path, "config", "add-api-key", key, "--log=stdout"]
else:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_ngrok.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,8 @@ def test_labels_no_api_key_fails(self):
config_path = os.path.join(self.config_dir, "config_v3_2.yml")
installer.install_default_config(config_path, config, ngrok_version="v3")
pyngrok_config = self.copy_with_updates(self.pyngrok_config_v3, config_path=config_path,
auth_token=os.environ["NGROK_AUTHTOKEN"])
auth_token=os.environ["NGROK_AUTHTOKEN"],
api_key=None)

# WHEN
with self.assertRaises(PyngrokError):
Expand Down

0 comments on commit 69f0ea7

Please sign in to comment.