Fix REST API for RepositoryInfoResource
Review Request #1631 — Created June 1, 2010 and submitted
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
-
-
-
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.
-
-
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.
-
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
-
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.