========================================================================
http://mondrian.corp.google.com/file/8228214///depot/googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py?a=3
File
//depot/googleclient/gears/opensource/gears/test/testcases/cgi/location_provider.py
(snapshot 3)
------------------------------------
Line 3: """ A dummy location provider to be used in the Geolocation API tests.
On Thu Sep 11 10:03:46 2008 PDT, steveblock wrote:
> I've been using the term 'network location provider'.
Done.
------------------------------------
Line 6: by special values in the position fix request supplied as the body of
an HTTP
On Thu Sep 11 09:57:46 2008 PDT, playmobil wrote:
> Mondrian is showing a bunch of extra whitespaces at end of lines in this file.
Done.
------------------------------------
Line 10: Currently the following conditions are honored by this scriptlet:
On Thu Sep 11 10:10:34 2008 PDT, steveblock wrote:
> I think we should make clear that we're testing 3 cases
> - the server returns a good/valid position fix
> - the server couldn't get a good fix
> - the request was malformed
> We do this by returning a populated location object, a null location object
and
> a 400 respectively.
Done.
------------------------------------
Line 12: a correctly formatted JSON response (GOOD_JSON_RESPONSE below) is
returned.
On Thu Sep 11 10:06:40 2008 PDT, steveblock wrote:
> Both this response and the following one should be correctly formatted - but
> this should be a 'good' fix, while the following is a 'location not found'
> response.
Done.
------------------------------------
Line 33: to decode the request_body into a dictionary an error will be thrown.
On Thu Sep 11 09:55:23 2008 PDT, playmobil wrote:
> How about shortening this to simply:
> "Initialize FixRequest with a JSON string"
Done.
------------------------------------
Line 36: request_body: String representation of the request body, must be well
On Thu Sep 11 09:53:57 2008 PDT, playmobil wrote:
> *well formed
Done.
------------------------------------
Line 44: def __HasValueInFixRequest(self, expected_value, key_name,
dictionary_name):
On Thu Sep 11 10:36:32 2008 PDT, steveblock wrote:
> You're looking for a key with name dictionary_name, the value of which you
> assume to be a list of dictionaries. Within each of those dictionaries, you
look
> for a key named 'key_name' and test for 'expected_value'. So I think that
> 'dictionary_name' should be renamed 'outer_key' and 'key_name' should be
renamed
> 'inner_key', or some more descriptive naming scheme.
Done. Added helper method to first extract the list from the fix_request, which
I guess made it more readible. Also added type checkers.
------------------------------------
Line 56: dictionary = self.request[dictionary_name]
On Thu Sep 11 10:38:32 2008 PDT, steveblock wrote:
> This is isn't a dictionary. It's a list of dictionaries. Also, can you test to
> check this?
Done.
------------------------------------
Line 59: value = item.get(key_name, None)
On Thu Sep 11 10:37:32 2008 PDT, steveblock wrote:
> Similarly, you assume that item is a dictionary. Can you test for this?
Done.
------------------------------------
Line 69: mac_address: The string mac address to look for, no format
restrictions.
On Thu Sep 11 09:59:08 2008 PDT, playmobil wrote:
> The String -> string, the mac address
Done.
------------------------------------
Line 84: # A correct position fix response, location data for the Google London
office.
On Thu Sep 11 09:59:49 2008 PDT, playmobil wrote:
> nit: correct -> valid
Done.
------------------------------------
Line 126: json_response = None
On Thu Sep 11 10:01:07 2008 PDT, playmobil wrote:
> Could you move these inside the body of the if so their declaration doesn't
leak
> outside this module.
Done.
------------------------------------
Line 136: if fix_request.HasMacAddress("good_mac_address") :
On Thu Sep 11 10:01:35 2008 PDT, playmobil wrote:
> ) : -> ):
Done.
------------------------------------
Line 143: send_response(self, 500, "Please provide a POST method.")
On Thu Sep 11 10:12:39 2008 PDT, steveblock wrote:
> Shouldn't this be a 4XX code?
Correct, should be 405 (method not allowed)
========================================================================
--
To respond, reply to this email or visit http://mondrian.corp.google.com/8228214