| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Unit tests for autoupdate.py.""" | 7 """Unit tests for autoupdate.py.""" |
| 8 | 8 |
| 9 import cherrypy | 9 import cherrypy |
| 10 import mox | 10 import mox |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 self.static_image_dir, 'update.gz')).AndReturn(self.size) | 117 self.static_image_dir, 'update.gz')).AndReturn(self.size) |
| 118 autoupdate.Autoupdate.GetUpdatePayload( | 118 autoupdate.Autoupdate.GetUpdatePayload( |
| 119 self.hash, self.sha256, self.size, self.url, False).AndReturn( | 119 self.hash, self.sha256, self.size, self.url, False).AndReturn( |
| 120 self.payload) | 120 self.payload) |
| 121 | 121 |
| 122 self.mox.ReplayAll() | 122 self.mox.ReplayAll() |
| 123 au_mock = self._DummyAutoupdateConstructor() | 123 au_mock = self._DummyAutoupdateConstructor() |
| 124 self.assertEqual(au_mock.HandleUpdatePing(test_data), self.payload) | 124 self.assertEqual(au_mock.HandleUpdatePing(test_data), self.payload) |
| 125 self.mox.VerifyAll() | 125 self.mox.VerifyAll() |
| 126 | 126 |
| 127 def testChangeUrlPort(self): |
| 128 r = autoupdate._ChangeUrlPort('http://fuzzy:8080/static', 8085) |
| 129 self.assertEqual(r, 'http://fuzzy:8085/static') |
| 130 |
| 131 r = autoupdate._ChangeUrlPort('http://fuzzy/static', 8085) |
| 132 self.assertEqual(r, 'http://fuzzy:8085/static') |
| 133 |
| 134 r = autoupdate._ChangeUrlPort('ftp://fuzzy/static', 8085) |
| 135 self.assertEqual(r, 'ftp://fuzzy:8085/static') |
| 136 |
| 137 r = autoupdate._ChangeUrlPort('ftp://fuzzy', 8085) |
| 138 self.assertEqual(r, 'ftp://fuzzy:8085') |
| 139 |
| 127 | 140 |
| 128 if __name__ == '__main__': | 141 if __name__ == '__main__': |
| 129 unittest.main() | 142 unittest.main() |
| OLD | NEW |