Add support for --proxy_port.
For some test programs, we want incoming update requests to come to an
alternate port from the devserver port, and to run the dev server at the
normal port (there will be a proxy between the two that manipulates the
data).
This new option directs the client to the proxies port without changing
the server port.
Change-Id: If4bd7a9681bdafd8412c2a0200fd9bf364f501ef
BUG=chromium-os:8207
TEST=
Review URL: http://codereview.chromium.org/5611004
diff --git a/autoupdate_unittest.py b/autoupdate_unittest.py
index 029f1c9..c1bfcee 100755
--- a/autoupdate_unittest.py
+++ b/autoupdate_unittest.py
@@ -124,6 +124,19 @@
self.assertEqual(au_mock.HandleUpdatePing(test_data), self.payload)
self.mox.VerifyAll()
+ def testChangeUrlPort(self):
+ r = autoupdate._ChangeUrlPort('http://fuzzy:8080/static', 8085)
+ self.assertEqual(r, 'http://fuzzy:8085/static')
+
+ r = autoupdate._ChangeUrlPort('http://fuzzy/static', 8085)
+ self.assertEqual(r, 'http://fuzzy:8085/static')
+
+ r = autoupdate._ChangeUrlPort('ftp://fuzzy/static', 8085)
+ self.assertEqual(r, 'ftp://fuzzy:8085/static')
+
+ r = autoupdate._ChangeUrlPort('ftp://fuzzy', 8085)
+ self.assertEqual(r, 'ftp://fuzzy:8085')
+
if __name__ == '__main__':
unittest.main()