Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: autoupdate_unittest.py

Issue 5297002: --archive_dir will now serve existing update.gz (Closed) Base URL: http://git.chromium.org/git/dev-util.git@master
Patch Set: Code review fixes. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « autoupdate.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 testHandleUpdatePingForArchivedBuild(self):
128 self.mox.StubOutWithMock(autoupdate.Autoupdate, 'GenerateImageFromZip')
129
130 test_data = _TEST_REQUEST % self.test_dict
131
132 autoupdate.Autoupdate.GenerateImageFromZip(
133 self.static_image_dir).AndReturn('update.gz')
134 autoupdate.Autoupdate._GetHash(os.path.join(
135 self.static_image_dir, 'update.gz')).AndReturn(self.hash)
136 autoupdate.Autoupdate._GetSHA256(os.path.join(
137 self.static_image_dir, 'update.gz')).AndReturn(self.sha256)
138 autoupdate.Autoupdate._GetSize(os.path.join(
139 self.static_image_dir, 'update.gz')).AndReturn(self.size)
140 autoupdate.Autoupdate.GetUpdatePayload(
141 self.hash, self.sha256, self.size,
142 'http://%s/static/archive/update.gz' % self.hostname,
143 False).AndReturn(
144 self.payload)
145
146 self.mox.ReplayAll()
147 au_mock = self._DummyAutoupdateConstructor()
148 au_mock.serve_only = True
149 au_mock.static_urlbase = 'http://%s/static/archive' % self.hostname
150 self.assertEqual(au_mock.HandleUpdatePing(test_data), self.payload)
151 self.mox.VerifyAll()
152
153 127
154 if __name__ == '__main__': 128 if __name__ == '__main__':
155 unittest.main() 129 unittest.main()
OLDNEW
« no previous file with comments | « autoupdate.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698