示例#1
0
def validate_pii_config_update(organization, value):
    if not value:
        return value

    try:
        sentry_relay.validate_pii_config(value)
    except ValueError as e:
        raise serializers.ValidationError(e)

    return value
示例#2
0
def validate_pii_config_update(organization, value):
    if not value:
        return value

    has_datascrubbers_v2 = features.has("organizations:datascrubbers-v2",
                                        organization)
    if not has_datascrubbers_v2:
        raise serializers.ValidationError(
            "Organization does not have the datascrubbers-v2 feature enabled")

    try:
        sentry_relay.validate_pii_config(value)
    except ValueError as e:
        raise serializers.ValidationError(e)

    return value
示例#3
0
def test_validate_pii_config():
    sentry_relay.validate_pii_config("{}")
    sentry_relay.validate_pii_config('{"applications": {}}')

    with pytest.raises(ValueError):
        sentry_relay.validate_pii_config('{"applications": []}')

    with pytest.raises(ValueError):
        sentry_relay.validate_pii_config('{"applications": true}')
示例#4
0
    def validate_relayPiiConfig(self, value):
        if not value:
            return value

        organization = self.context["project"].organization
        request = self.context["request"]
        has_datascrubbers_v2 = features.has(
            "organizations:datascrubbers-v2", organization, actor=request.user
        )
        if not has_datascrubbers_v2:
            raise serializers.ValidationError(
                "Organization does not have the datascrubbers-v2 feature enabled"
            )

        try:
            validate_pii_config(value)
        except ValueError as e:
            raise serializers.ValidationError(e)

        return value