Skip to content

Commit

Permalink
fix: remove event_stream_type from the payload when creating/updating…
Browse files Browse the repository at this point in the history
… event streams (#1092)
  • Loading branch information
hsong-rh authored Oct 10, 2024
1 parent ee2bc4f commit d83f540
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 57 deletions.
1 change: 0 additions & 1 deletion src/aap_eda/api/serializers/event_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class Meta:
"additional_data_headers",
"eda_credential_id",
"organization_id",
"event_stream_type",
]


Expand Down
56 changes: 0 additions & 56 deletions tests/integration/api/test_event_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,34 +147,6 @@ def test_update_event_stream(
)


@pytest.mark.django_db
def test_update_event_stream_with_mismatched_type(
admin_client: APIClient,
default_hmac_credential: models.EdaCredential,
default_organization: models.Organization,
default_event_stream: models.EventStream,
):
invalid_event_stream_type = "mismatched_type"
data_in = {
"name": "new_test_event_stream",
"event_stream_type": invalid_event_stream_type,
}
with override_settings(
EVENT_STREAM_BASE_URL="https://www.example.com/",
):
response = admin_client.patch(
f"{api_url_v1}/event-streams/{default_event_stream.id}/",
data=data_in,
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
assert (
f"The input event stream type {invalid_event_stream_type} does "
"not match with the credential type "
f"{default_hmac_credential.credential_type.kind}"
in response.data["non_field_errors"]
)


@pytest.mark.django_db
def test_create_event_stream_without_credentials(
admin_client: APIClient, default_organization: models.Organization
Expand All @@ -190,34 +162,6 @@ def test_create_event_stream_without_credentials(
}


@pytest.mark.django_db
def test_create_event_stream_with_mismatched_types(
admin_client: APIClient,
default_organization: models.Organization,
default_hmac_credential: models.EdaCredential,
):
invalid_event_stream_type = "invalid_type"
data_in = {
"name": "test_es",
"event_stream_type": invalid_event_stream_type,
"eda_credential_id": default_hmac_credential.id,
"organization_id": default_organization.id,
}
with override_settings(
EVENT_STREAM_BASE_URL="https://www.example.com/",
):
response = admin_client.post(
f"{api_url_v1}/event-streams/", data=data_in
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
assert (
f"The input event stream type {invalid_event_stream_type} does "
"not match with the credential type "
f"{default_hmac_credential.credential_type.kind}"
in response.data["non_field_errors"]
)


@pytest.mark.django_db
def test_delete_event_stream(
admin_client: APIClient,
Expand Down

0 comments on commit d83f540

Please sign in to comment.