Skip to content

Commit

Permalink
test: database clusters metrics credentials (#350)
Browse files Browse the repository at this point in the history
* test: database clusters metrics credentials

Signed-off-by: Aryan Bakliwal <106430579+AryanBakliwal@users.noreply.github.com>

* mocked tests: fix linting

Signed-off-by: Aryan Bakliwal <106430579+AryanBakliwal@users.noreply.github.com>

---------

Signed-off-by: Aryan Bakliwal <106430579+AryanBakliwal@users.noreply.github.com>
  • Loading branch information
AryanBakliwal authored Oct 1, 2024
1 parent c3e2f8b commit 343a94b
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/mocked/test_databases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,3 +1054,48 @@ def test_databases_update_sql_mode(mock_client: Client, mock_client_url):
)

assert resp is None


@responses.activate
def test_databases_get_metrics_credentials(mock_client: Client, mock_client_url):
"""Mocks the databases retrieve clusters' metrics endpoint credentials operation."""

expected = {
"credentials": {
"basic_auth_username": "username",
"basic_auth_password": "password",
}
}

responses.add(
responses.GET,
f"{mock_client_url}/v2/databases/metrics/credentials",
json=expected,
status=200,
)

resp = mock_client.databases.get_cluster_metrics_credentials()

assert expected == resp


@responses.activate
def test_databases_update_metrics_credentials(mock_client: Client, mock_client_url):
"""Mocks the databases update clusters' metrics endpoint credentials operation."""

responses.add(
responses.PUT,
f"{mock_client_url}/v2/databases/metrics/credentials",
status=204,
)

resp = mock_client.databases.update_cluster_metrics_credentials(
{
"credentials": {
"basic_auth_username": "new_username",
"basic_auth_password": "new_password",
}
}
)

assert resp is None

0 comments on commit 343a94b

Please sign in to comment.