Skip to content

Commit

Permalink
fix(cdp): error testing free functions (#25809)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusandra authored Oct 25, 2024
1 parent 376c6ee commit 1d16306
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 15 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions frontend/src/scenes/pipeline/pipelineAccessLogic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ export const pipelineAccessLogic = kea<pipelineAccessLogicType>([
canEnableNewDestinations: [
(s) => [s.user, s.hasAvailableFeature],
(user, hasAvailableFeature) =>
user?.is_impersonated ||
(canConfigurePlugins(user?.organization) && hasAvailableFeature(AvailableFeature.DATA_PIPELINES)),
canConfigurePlugins(user?.organization) && hasAvailableFeature(AvailableFeature.DATA_PIPELINES),
],

canEnableDestination: [
Expand Down
10 changes: 0 additions & 10 deletions posthog/api/hog_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,6 @@ def validate(self, attrs):
{"template_id": "The Data Pipelines addon is required for this template."}
)

if attrs.get("hog"):
raise serializers.ValidationError(
{"hog": "The Data Pipelines addon is required to create custom functions."}
)

if attrs.get("inputs_schema"):
raise serializers.ValidationError(
{"inputs_schema": "The Data Pipelines addon is required to create custom functions."}
)

# Without the addon, they cannot deviate from the template
attrs["inputs_schema"] = template.inputs_schema
attrs["hog"] = template.hog
Expand Down
7 changes: 4 additions & 3 deletions posthog/api/test/test_hog_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ def test_free_users_cannot_override_hog_or_schema(self):
],
}
)

assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
assert response.json()["detail"] == "The Data Pipelines addon is required to create custom functions."
new_response = response.json()
# These did not change
assert new_response["hog"] == template_slack.hog
assert new_response["inputs_schema"] == template_slack.inputs_schema

def test_free_users_cannot_use_without_template(self):
response = self._create_slack_function({"template_id": None})
Expand Down

0 comments on commit 1d16306

Please sign in to comment.