Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions newsfragments/1484.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add a ``delete-model-target-web-api-credentials`` command, which deletes
one Model Target Web API OAuth2 client credential by its client ID.
1 change: 1 addition & 0 deletions spelling_private_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ DOM
OAuth
SVG
XPath
api
beartype
changelog
cli
Expand Down
28 changes: 28 additions & 0 deletions src/vws_web_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,33 @@ def show_vumark_database_details(
click.echo(message=yaml.dump(data=details), nl=False)


@click.command(name="delete-model-target-web-api-credentials")
@click.option("--client-id", required=True)
@click.option("--email-address", envvar="VWS_EMAIL_ADDRESS", required=True)
@click.option("--password", envvar="VWS_PASSWORD", required=True)
@beartype
def delete_model_target_web_api_credentials(
*,
client_id: str,
email_address: str,
password: str,
) -> None:
"""Delete one Model Target Web API client credential."""
driver = create_chrome_driver()
try:
log_in(
driver=driver,
email_address=email_address,
password=password,
)
delete_model_target_web_api_client_credentials(
driver=driver,
client_id=client_id,
)
finally:
driver.quit()


@click.command()
@click.option("--license-name", required=True)
@click.option("--email-address", envvar="VWS_EMAIL_ADDRESS", required=True)
Expand Down Expand Up @@ -1747,6 +1774,7 @@ def show_license_details(
vws_web_tools_group.add_command(cmd=create_vws_cloud_database)
vws_web_tools_group.add_command(cmd=create_vws_license)
vws_web_tools_group.add_command(cmd=create_vws_vumark_database)
vws_web_tools_group.add_command(cmd=delete_model_target_web_api_credentials)
vws_web_tools_group.add_command(cmd=delete_vws_license)
vws_web_tools_group.add_command(cmd=get_vumark_instance_id)
vws_web_tools_group.add_command(cmd=show_database_details)
Expand Down
28 changes: 28 additions & 0 deletions tests/test_create_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,34 @@ def test_get_model_target_web_api_details_library(
)


def test_delete_model_target_web_api_credentials_cli(
*,
vws_credentials: VWSCredentials,
logged_in_chrome_driver: WebDriver,
) -> None:
"""Test deleting Model Target Web API credentials via the CLI."""
details = vws_web_tools.get_model_target_web_api_details(
driver=logged_in_chrome_driver,
)

runner = CliRunner()
result = runner.invoke(
cli=vws_web_tools_group,
args=[
"delete-model-target-web-api-credentials",
"--client-id",
details["client_id"],
"--email-address",
vws_credentials.email_address,
"--password",
vws_credentials.password,
],
catch_exceptions=False,
)

assert result.exit_code == 0


def test_show_license_details_cli(
*,
vws_credentials: VWSCredentials,
Expand Down
22 changes: 12 additions & 10 deletions tests/test_help/test_vws_command_help____.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ Options:
--help Show this message and exit.

Commands:
create-vws-cloud-database Create a cloud database.
create-vws-license Create a license.
create-vws-vumark-database Create a VuMark database.
delete-vws-license Delete a license.
get-vumark-instance-id Get the VuMark instance ID for a target.
show-database-details Show the details of a database.
show-license-details Show the details of a license.
show-vumark-database-details Show the details of a VuMark database.
upload-vumark-template Upload a VuMark SVG template to a VuMark...
wait-for-vumark-instance-id Wait for and get the VuMark instance ID for...
create-vws-cloud-database Create a cloud database.
create-vws-license Create a license.
create-vws-vumark-database Create a VuMark database.
delete-model-target-web-api-credentials
Delete one Model Target Web API...
delete-vws-license Delete a license.
get-vumark-instance-id Get the VuMark instance ID for a...
show-database-details Show the details of a database.
show-license-details Show the details of a license.
show-vumark-database-details Show the details of a VuMark...
upload-vumark-template Upload a VuMark SVG template to...
wait-for-vumark-instance-id Wait for and get the VuMark...
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Usage: vws-web delete-model-target-web-api-credentials [OPTIONS]

Delete one Model Target Web API client credential.

Options:
--client-id TEXT [required]
--email-address TEXT [required]
--password TEXT [required]
--help Show this message and exit.