-
-
reviewboard/webapi/resources.py (Diff revision 1) I could be wrong here (still new myself to the WebAPI code), but since Repository is not actually a child of another resource, I think we can omit this line. I made the change on my end, still seems to work alright.
Fix REST API for RepositoryInfoResource
Review Request #1631 — Created June 1, 2010 and submitted
Information | |
---|---|
farktronix | |
Review Board | |
Reviewers | |
reviewboard | |
Accessing a repository's info through the REST API was resulting in an exception due to a missing argument to get_object(). RepositoryInfoResource was also missing some required variables that get_object() needed.
Added a unit test for RepositoryInfoResource
-
-
-
reviewboard/webapi/resources.py (Diff revision 1) Actually, this should probably do: repository = repository_resource.get_object(request, *args, **kwargs) Then we don't need the model above or the uri_object_key. This file would only have a single line.
-
reviewboard/webapi/tests.py (Diff revision 1) This should use the same format as other unit tests for dynamic parts of the path: "<id>"
-
reviewboard/webapi/tests.py (Diff revision 1) I'd prefer not hard-coding the number for this test. Instead, do a query first for a Repository entry using the SVNTool. Then plug that ID in and reuse that repository for the check below. That way, if the fixtures change and the Repository we can test with has a new ID, we're not broken by it.
-
reviewboard/webapi/tests.py (Diff revision 1) The parameters should be aligned. They can both be on their own lines, indented 3 spaces from "self.assertEqual"
-
Jacob: Just one last small thing from me - see below, -Mike
-
reviewboard/webapi/tests.py (Diff revision 2) Actually, since RepositoryResourceTests inherits from BaseWebAPITestCase, I think you get the repo for free with self.repository. (See reviewboard/webapi/tests.py lines 36 - 39). So you can omit this line, and below: rsp = self.apiGet(... % self.repository.pk) ... self.assertEqual(rsp['info'], self.repository.get_scmtool().get_repository_info()) Tested it locally, seems to work.