-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CZID-8697] Codegen tests - part 1 #119
Conversation
…mics into raboukhalil/CZID-8697-codegen-tests
# Make sure tests can get their own instances of the app. | ||
def get_app() -> FastAPI: | ||
def get_app(use_test_schema: bool = False) -> FastAPI: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow us to define whether to use the test schema or not
|
||
import pytest | ||
from api.conftest import GQLTestClient | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example of where tests on our real schema would go
@@ -123,6 +125,9 @@ def api_generate(ctx: click.Context, schemafile: str, output_prefix: str) -> Non | |||
view.imports_closure() | |||
wrapped_view = ViewWrapper(view) | |||
|
|||
for dir in DIR_CODEGEN: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first time you run codegen, folders don't exist
@@ -13,7 +13,7 @@ from api.types.{{ class.snake_name }} import {{ class.name }}, resolve_{{ class. | |||
@strawberry.type | |||
class Query: | |||
# Allow queries by node ID | |||
node: relay.Node = relay.node() | |||
nodes: List[relay.Node] = relay.node() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the relay query as per Strawberry docs to support an array of node IDs (will check with FE team what they're expected use case for this is)
from fastapi import FastAPI | ||
from api.conftest import GQLTestClient | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to be sure we're testing the right schema 🙂
…mics into raboukhalil/CZID-8697-codegen-tests # Conflicts: # .gitattributes
Part 1 of adding codegen tests