def testGenerateXbuddyRequestForImage(self): """Tests that we generate correct requests to get images.""" image_path = 'foo/bar/taco' self.assertEqual( dev_server_wrapper.GenerateXbuddyRequest(image_path, 'image'), 'xbuddy/foo/bar/taco?return_dir=true') image_path = 'xbuddy://foo/bar/taco' self.assertEqual( dev_server_wrapper.GenerateXbuddyRequest(image_path, 'image'), 'xbuddy/foo/bar/taco?return_dir=true')
def testGenerateXbuddyRequestForTranslate(self): """Tests that we generate correct requests for translation.""" image_path = 'foo/bar/taco' self.assertEqual( dev_server_wrapper.GenerateXbuddyRequest(image_path, 'translate'), 'xbuddy_translate/foo/bar/taco') image_path = 'xbuddy://foo/bar/taco' self.assertEqual( dev_server_wrapper.GenerateXbuddyRequest(image_path, 'translate'), 'xbuddy_translate/foo/bar/taco')
def testGenerateXbuddyRequestForUpdate(self): """Test we generate correct xbuddy requests.""" # Use the latest build when 'latest' is given. req = 'xbuddy/latest?for_update=true&return_dir=true' self.assertEqual( dev_server_wrapper.GenerateXbuddyRequest('latest', 'update'), req) # Convert the path starting with 'xbuddy://' to 'xbuddy/' path = 'xbuddy://remote/stumpy/version' req = 'xbuddy/remote/stumpy/version?for_update=true&return_dir=true' self.assertEqual( dev_server_wrapper.GenerateXbuddyRequest(path, 'update'), req)