Skip to content

Commit

Permalink
move test
Browse files Browse the repository at this point in the history
  • Loading branch information
thingscouldbeworse committed Dec 20, 2024
1 parent b6dbdd6 commit ef91b70
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions tests/ops/api/v1/endpoints/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,35 @@ def connections():
]


class TestPatchSystem:
def test_system_patch_hidden(
self,
system,
api_client: TestClient,
generate_auth_header,
db: Session,
):
url = V1_URL_PREFIX + f"/system/hidden"
auth_header = generate_auth_header(
scopes=[SYSTEM_UPDATE, SYSTEM_MANAGER_UPDATE]
)

result = api_client.patch(
url=f"{url}?hidden=true",
headers=auth_header,
json=[system.fides_key],
)
assert result.status_code == HTTP_200_OK
assert result.json() == {
"message": "Updated hidden status for systems",
"updated": 1,
}

query = "SELECT hidden FROM ctl_systems WHERE fides_key = :fides_key"
result = db.execute(query, {"fides_key": system.fides_key}).fetchone()
assert result[0] is True


class TestPatchSystemConnections:
@pytest.fixture(scope="function")
def system_linked_with_oauth2_authorization_code_connection_config(
Expand Down Expand Up @@ -274,33 +303,6 @@ def test_patch_connection_secrets_removes_access_token_for_client_config(
assert resp.status_code == HTTP_200_OK
assert resp.json()["items"][0]["authorized"] is False

def test_system_patch_hidden(
self,
system,
api_client: TestClient,
generate_auth_header,
db: Session,
):
url = V1_URL_PREFIX + f"/system/hidden"
auth_header = generate_auth_header(
scopes=[SYSTEM_UPDATE, SYSTEM_MANAGER_UPDATE]
)

result = api_client.patch(
url=f"{url}?hidden=true",
headers=auth_header,
json=[system.fides_key],
)
assert result.status_code == HTTP_200_OK
assert result.json() == {
"message": "Updated hidden status for systems",
"updated": 1,
}

query = "SELECT hidden FROM ctl_systems WHERE fides_key = :fides_key"
result = db.execute(query, {"fides_key": system.fides_key}).fetchone()
assert result[0] is True


class TestGetConnections:
def test_get_connections_not_authenticated(
Expand Down

0 comments on commit ef91b70

Please sign in to comment.