Skip to content

Commit

Permalink
FIX: Ensure the backend field of a child cannot be empty
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Jan 26, 2021
1 parent 6b73b15 commit f8ab34b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/test_children.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def test_extra_children(self):
with self.assertRaises(exceptions.InvalidValuesContents):
Twine().validate_children(source=self.VALID_CHILD_VALUE)

def test_backend_cannot_be_empty(self):
""" Test that the backend field of a child cannot be empty. """
single_child_missing_backend = """[{"key": "gis", "id": "some-id", "backend": {}}]"""

with self.assertRaises(exceptions.InvalidValuesContents):
Twine().validate_children(source=single_child_missing_backend)

def test_extra_key_validation_on_empty_twine(self):
""" Test that children with extra data will not raise a validation error on an empty twine.
"""
Expand Down
3 changes: 2 additions & 1 deletion twined/schema/children_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"description": "Absolute path to Google Cloud Platform credentials JSON file.",
"type": "string"
}
}
},
"required": ["name", "project_name", "credentials_filename"]
}
]
}
Expand Down

0 comments on commit f8ab34b

Please sign in to comment.