def test_build_url_with_numbers(self):
        rslt = "123/456/abc/hithere"
        urls = [
            (1, (123, 456, "abc", "hithere")),
            (2, ("123", 456, "abc", "hithere")),
            (3, (123, "456", "abc", "hithere")),
            (4, ("123", "456", "abc", "hithere")),
        ]
        for tn, param in urls:
            tr = build_url(param)
            self.assertEqual(rslt, tr)

            tr = build_url(*param)
            self.assertEqual(rslt, tr)
 def _POST(self, data, *url_parts):
     """
     Put together a full POST request and send to our cloudServersService.
     """
     url = build_url(self._requestPrefix, *url_parts)
     retVal = self._cloudServersService.POST(url, data=data)
     return(retVal)
 def _DELETE(self, id, *url_parts):
     """
     Put together a full DELETE request and send it on via our 
     cloudServersService
     """
     url = build_url(self._requestPrefix, id, *url_parts)
     retVal = self._cloudServersService.DELETE(url)
     return retVal
    def test_build_url(self):
        tiat = "this/is/a/test"
        urls = [
            # Simple list of params
            (1, ("this", "is", "a", "test")),
            # leading and trailing '/'
            (2, ("////this///", "////is///", "//////a/////", "///////test//////")),
            # sequence + string
            (3, (("this", "is", "a"), "test")),
            # whitespace
            (4, ("  this  ", "\r\nis  \r\n", "\t\r\n a\r\n\t", "    test    ")),
        ]

        for tn, param in urls:
            tr = build_url(param)
            self.assertEqual(tiat, tr)

            tr = build_url(*param)
            self.assertEqual(tiat, tr)
 def _PUT(self, *url_parts):
     url = build_url(self._requestPrefix, *url_parts)
     retVal = self._cloudServersService.PUT(url)
     return retVal
 def _GET(self, url, params=None, headers=None, retHeaders=None):
     url = build_url(self._requestPrefix, url)
     retVal = self._cloudServersService.GET(url, params, headers=headers,
             retHeaders=retHeaders)
     return retVal