OLD | NEW |
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Module containing a test suite that is run to test auto updates.""" | 5 """Module containing a test suite that is run to test auto updates.""" |
6 | 6 |
7 import os | 7 import os |
8 import tempfile | 8 import tempfile |
9 import time | 9 import time |
10 import unittest | 10 import unittest |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 # --- UNITTEST SPECIFIC METHODS --- | 110 # --- UNITTEST SPECIFIC METHODS --- |
111 | 111 |
112 def setUp(self): | 112 def setUp(self): |
113 """Overrides unittest.TestCase.setUp and called before every test. | 113 """Overrides unittest.TestCase.setUp and called before every test. |
114 | 114 |
115 Sets instance specific variables and initializes worker. | 115 Sets instance specific variables and initializes worker. |
116 """ | 116 """ |
117 unittest.TestCase.setUp(self) | 117 unittest.TestCase.setUp(self) |
118 self.worker = self.worker_class(self.options, AUTest.test_results_root) | 118 self.worker = self.worker_class(self.options, AUTest.test_results_root) |
119 self.crosutils = os.path.join(os.path.dirname(__file__), '..', '..') | 119 self.download_folder = os.path.join(os.path.realpath(os.path.curdir), |
120 self.download_folder = os.path.join(self.crosutils, 'latest_download') | 120 'latest_download') |
121 if not os.path.exists(self.download_folder): | 121 if not os.path.exists(self.download_folder): |
122 os.makedirs(self.download_folder) | 122 os.makedirs(self.download_folder) |
123 | 123 |
124 def tearDown(self): | 124 def tearDown(self): |
125 """Overrides unittest.TestCase.tearDown and called after every test.""" | 125 """Overrides unittest.TestCase.tearDown and called after every test.""" |
126 self.worker.CleanUp() | 126 self.worker.CleanUp() |
127 | 127 |
128 def testUpdateKeepStateful(self): | 128 def testUpdateKeepStateful(self): |
129 """Tests if we can update normally. | 129 """Tests if we can update normally. |
130 | 130 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \ | 279 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \ |
280 'autest-images/corrupted_image.gz' | 280 'autest-images/corrupted_image.gz' |
281 payload = os.path.join(self.download_folder, 'corrupted.gz') | 281 payload = os.path.join(self.download_folder, 'corrupted.gz') |
282 | 282 |
283 # Read from the URL and write to the local file | 283 # Read from the URL and write to the local file |
284 urllib.urlretrieve(url, payload) | 284 urllib.urlretrieve(url, payload) |
285 | 285 |
286 # This update is expected to fail... | 286 # This update is expected to fail... |
287 expected_msg = 'zlib inflate() error:-3' | 287 expected_msg = 'zlib inflate() error:-3' |
288 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg) | 288 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg) |
OLD | NEW |