-
Notifications
You must be signed in to change notification settings - Fork 14
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
Handle VitalSource assignments in the creation endpoint schema #3327
Conversation
bookID = fields.Str(required=False, allow_none=True) | ||
cfi = fields.Str(required=False, allow_none=True) | ||
"""VitalSource IDs""" |
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.
I think the bookID
and cfi
fields must be present if type
is "vitalsource"
and must not be present otherwise. We'd need to add that to the @validates_schema()
method below I think. Let's make sure we have good unit tests for this as it'd be easy to mess up.
It's getting to the point where I feel we have three separate schemas here (one for URLs, one for files, and one for VitalSource) and we should have a meta-schema that tries to validate the request using each of the sub-schemas in turn. I'm not exactly sure how we'd implement that though.
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.
I don't think a few conditionals here are to bad, at least for now where different types don't interact with each other.
and must not be present otherwise
Not sure about that one I think if the type says "vitalsource" and we have enough information we should accept it even it also sends something in the URL, same for the other types. I'd be liberal in what you accept
here.
eab0902
to
518a2d0
Compare
content = data["content"] | ||
type_ = data["content"]["type"] |
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.
I'd say this makes the rest easier to read, not sure.
518a2d0
to
1b61b9c
Compare
def test_it_doesnt_raise_valid__assignment( | ||
self, json_request, assignment_fixture_name, request | ||
): | ||
assignment_body = request.getfixturevalue(assignment_fixture_name) |
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.
Went for this style on the happy path ones
Testing