graphql-engine/v3/crates/engine/tests/introspection.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.8 KiB
Rust
Raw Normal View History

#[allow(dead_code)]
mod common;
#[test]
fn test_introspect_command_with_preset_arguments() -> anyhow::Result<()> {
let common_metadata_path_string = "execute/common_metadata/custom_connector_schema.json";
let common_command_metadata_path_string = "execute/common_metadata/command_metadata.json";
common::test_introspection_expectation(
add support for argument presets in models (#348) <!-- Thank you for submitting this PR! :) --> ## Description Following on https://github.com/hasura/v3-engine/pull/340 (and stacked on top of it, as such) - this adds preset arguments for models, allowing hard coded values for different roles. ```yaml kind: ModelPermissions version: v1 definition: modelName: ActorsByMovie permissions: - role: admin select: filter: argumentPresets: - argument: movie_id value: literal: 3 ``` <!-- Questions to consider answering: 1. What user-facing changes are being made? 2. What are issues related to this PR? (Consider adding `(close #<issue-no>)` to the PR title) 3. What is the conceptual design behind this PR? 4. How can this PR be tested/verified? 5. Does the PR have limitations? 6. Does the PR introduce breaking changes? --> ## Changelog - Add a changelog entry (in the "Changelog entry" section below) if the changes in this PR have any user-facing impact. See [changelog guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide). - If no changelog is required ignore/remove this section and add a `no-changelog-required` label to the PR. ### Product _(Select all products this will be available in)_ - [X] community-edition - [X] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [X] enhancement - [ ] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> Allow setting preset values for arguments on models, based on user's role. <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> V3_GIT_ORIGIN_REV_ID: 7dd23bf78e92980384cb2b2e109305cdb42d1c0b
2024-03-20 11:41:17 +03:00
"execute/commands/functions/command_argument_presets/",
&[
common_metadata_path_string,
common_command_metadata_path_string,
],
)
add support for argument presets in models (#348) <!-- Thank you for submitting this PR! :) --> ## Description Following on https://github.com/hasura/v3-engine/pull/340 (and stacked on top of it, as such) - this adds preset arguments for models, allowing hard coded values for different roles. ```yaml kind: ModelPermissions version: v1 definition: modelName: ActorsByMovie permissions: - role: admin select: filter: argumentPresets: - argument: movie_id value: literal: 3 ``` <!-- Questions to consider answering: 1. What user-facing changes are being made? 2. What are issues related to this PR? (Consider adding `(close #<issue-no>)` to the PR title) 3. What is the conceptual design behind this PR? 4. How can this PR be tested/verified? 5. Does the PR have limitations? 6. Does the PR introduce breaking changes? --> ## Changelog - Add a changelog entry (in the "Changelog entry" section below) if the changes in this PR have any user-facing impact. See [changelog guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide). - If no changelog is required ignore/remove this section and add a `no-changelog-required` label to the PR. ### Product _(Select all products this will be available in)_ - [X] community-edition - [X] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [X] enhancement - [ ] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> Allow setting preset values for arguments on models, based on user's role. <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> V3_GIT_ORIGIN_REV_ID: 7dd23bf78e92980384cb2b2e109305cdb42d1c0b
2024-03-20 11:41:17 +03:00
}
#[test]
fn test_introspect_model_with_preset_arguments_select_many() -> anyhow::Result<()> {
add support for argument presets in models (#348) <!-- Thank you for submitting this PR! :) --> ## Description Following on https://github.com/hasura/v3-engine/pull/340 (and stacked on top of it, as such) - this adds preset arguments for models, allowing hard coded values for different roles. ```yaml kind: ModelPermissions version: v1 definition: modelName: ActorsByMovie permissions: - role: admin select: filter: argumentPresets: - argument: movie_id value: literal: 3 ``` <!-- Questions to consider answering: 1. What user-facing changes are being made? 2. What are issues related to this PR? (Consider adding `(close #<issue-no>)` to the PR title) 3. What is the conceptual design behind this PR? 4. How can this PR be tested/verified? 5. Does the PR have limitations? 6. Does the PR introduce breaking changes? --> ## Changelog - Add a changelog entry (in the "Changelog entry" section below) if the changes in this PR have any user-facing impact. See [changelog guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide). - If no changelog is required ignore/remove this section and add a `no-changelog-required` label to the PR. ### Product _(Select all products this will be available in)_ - [X] community-edition - [X] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [X] enhancement - [ ] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> Allow setting preset values for arguments on models, based on user's role. <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> V3_GIT_ORIGIN_REV_ID: 7dd23bf78e92980384cb2b2e109305cdb42d1c0b
2024-03-20 11:41:17 +03:00
let common_metadata_path_string = "execute/common_metadata/custom_connector_schema.json";
let common_command_metadata_path_string = "execute/common_metadata/command_metadata.json";
common::test_introspection_expectation(
"execute/commands/functions/model_argument_presets_select_many/",
&[
common_metadata_path_string,
common_command_metadata_path_string,
],
)
add support for argument presets in models (#348) <!-- Thank you for submitting this PR! :) --> ## Description Following on https://github.com/hasura/v3-engine/pull/340 (and stacked on top of it, as such) - this adds preset arguments for models, allowing hard coded values for different roles. ```yaml kind: ModelPermissions version: v1 definition: modelName: ActorsByMovie permissions: - role: admin select: filter: argumentPresets: - argument: movie_id value: literal: 3 ``` <!-- Questions to consider answering: 1. What user-facing changes are being made? 2. What are issues related to this PR? (Consider adding `(close #<issue-no>)` to the PR title) 3. What is the conceptual design behind this PR? 4. How can this PR be tested/verified? 5. Does the PR have limitations? 6. Does the PR introduce breaking changes? --> ## Changelog - Add a changelog entry (in the "Changelog entry" section below) if the changes in this PR have any user-facing impact. See [changelog guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide). - If no changelog is required ignore/remove this section and add a `no-changelog-required` label to the PR. ### Product _(Select all products this will be available in)_ - [X] community-edition - [X] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [X] enhancement - [ ] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> Allow setting preset values for arguments on models, based on user's role. <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> V3_GIT_ORIGIN_REV_ID: 7dd23bf78e92980384cb2b2e109305cdb42d1c0b
2024-03-20 11:41:17 +03:00
}
#[test]
fn test_introspect_model_with_preset_arguments_select_one() -> anyhow::Result<()> {
add support for argument presets in models (#348) <!-- Thank you for submitting this PR! :) --> ## Description Following on https://github.com/hasura/v3-engine/pull/340 (and stacked on top of it, as such) - this adds preset arguments for models, allowing hard coded values for different roles. ```yaml kind: ModelPermissions version: v1 definition: modelName: ActorsByMovie permissions: - role: admin select: filter: argumentPresets: - argument: movie_id value: literal: 3 ``` <!-- Questions to consider answering: 1. What user-facing changes are being made? 2. What are issues related to this PR? (Consider adding `(close #<issue-no>)` to the PR title) 3. What is the conceptual design behind this PR? 4. How can this PR be tested/verified? 5. Does the PR have limitations? 6. Does the PR introduce breaking changes? --> ## Changelog - Add a changelog entry (in the "Changelog entry" section below) if the changes in this PR have any user-facing impact. See [changelog guide](https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide). - If no changelog is required ignore/remove this section and add a `no-changelog-required` label to the PR. ### Product _(Select all products this will be available in)_ - [X] community-edition - [X] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [X] enhancement - [ ] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> Allow setting preset values for arguments on models, based on user's role. <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> V3_GIT_ORIGIN_REV_ID: 7dd23bf78e92980384cb2b2e109305cdb42d1c0b
2024-03-20 11:41:17 +03:00
let common_metadata_path_string = "execute/common_metadata/custom_connector_schema.json";
let common_command_metadata_path_string = "execute/common_metadata/command_metadata.json";
common::test_introspection_expectation(
"execute/commands/functions/model_argument_presets_select_one/",
&[
common_metadata_path_string,
common_command_metadata_path_string,
],
)
}
#[test]
fn test_graphql_deprecated() -> anyhow::Result<()> {
let common_custom_connector_path_string =
"execute/common_metadata/custom_connector_schema.json";
common::test_introspection_expectation(
"execute/deprecated",
&[common_custom_connector_path_string],
)
}