-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API V2: test that command is actually saved (#9827)
* API V2: test that command is actually saved * Build details page: normalize/trim command paths (second attempt) (#9831) Continuation of the work done in #9815 that didn't work as we expected. We weren't saving the commands properly when hitting the API since `serializers.SerializerMethodField` is a read-only field. This commit fixes this problem by using a different Serializer depending if it's a GET request or not, and if it's made by an Admin or not. It overrides the method `BuildViewSet.get_serializer_class` to manage these different cases and return the proper serializer. Done on top of #9827 to be sure the tests for saving commands are passing. * Feedback from review addressed - rename serializer to mention "ReadOnly" on it's class name - add docstrings to these serializers * Typo when accessing the action * Optional builder hash on local instance Old builds don't have the builder hash in the docroot, since that was implmented recently. Co-authored-by: Manuel Kaufmann <[email protected]> Co-authored-by: Benjamin Balder Bach <[email protected]>
- Loading branch information
1 parent
c4a15c8
commit 0aa6e2c
Showing
3 changed files
with
116 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters