Skip to content

Commit

Permalink
Merge pull request #57 from chanzuckerberg/jgadling/fix-viz-tests
Browse files Browse the repository at this point in the history
Fix field visibility tests.
  • Loading branch information
jgadling authored Jun 21, 2024
2 parents b3794d5 + 93c0c5e commit 04b37a8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion platformics/codegen/templates/api/types/class_name.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import database.models as db
import strawberry
import datetime
from platformics.api.core.query_builder import get_db_rows, get_aggregate_db_rows
from api.validators.{{cls.snake_name}} import {{cls.name}}CreateInputValidator, {{cls.name}}UpdateInputValidator
{%- if cls.create_fields %}
from api.validators.{{cls.snake_name}} import {{cls.name}}CreateInputValidator
{%- endif %}
{%- if cls.mutable_fields %}
from api.validators.{{cls.snake_name}} import {{cls.name}}UpdateInputValidator
{%- endif %}
{%- if render_files %}
from platformics.api.files import File, FileWhereClause
{%- endif %}
Expand Down
3 changes: 3 additions & 0 deletions test_app/schema/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ classes:
producing_run_id:
range: uuid
annotations:
mutable: false # This field can't be modified by an `Update` mutation
system_writable_only: True
owner_user_id:
range: integer
Expand Down Expand Up @@ -220,6 +221,7 @@ classes:
attributes:
file:
range: File
readonly: true
annotations:
cascade_delete: true
sequencing_reads:
Expand Down Expand Up @@ -340,4 +342,5 @@ classes:
range: string
required: true
annotations:
mutable: false
plural: ImmutableTypes
2 changes: 1 addition & 1 deletion test_app/tests/test_field_visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ async def test_update_fields(
]
fields = [field["name"] for field in create_type["inputFields"]]
# We have a limited subset of mutable fields on SequencingRead
assert set(fields) == set(["nucleicAcid", "clearlabsExport", "technology", "sampleId", "deletedAt"])
assert set(fields) == set(["nucleicAcid", "sampleId", "technology", "protocol", "deletedAt", "primerFileId", "collectionId"])


# Make sure we only allow certain fields to be set at entity creation time.
Expand Down

0 comments on commit 04b37a8

Please sign in to comment.