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

Side by Side Diff: gmerge_test.py

Issue 6839028: Fix gmerge unittest to pass use through environment. (Closed) Base URL: http://git.chromium.org/git/dev-util.git@master
Patch Set: Fix Created 9 years, 8 months 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 | « no previous file | 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) 2011 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2011 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 gmerge.""" 7 """Unit tests for gmerge."""
8 8
9 import gmerge 9 import gmerge
10 import os
10 import unittest 11 import unittest
11 12
12 class Flags(object): 13 class Flags(object):
13 def __init__(self, dictionary): 14 def __init__(self, dictionary):
14 self.__dict__.update(dictionary) 15 self.__dict__.update(dictionary)
15 16
16 17
17 class GMergeTest(unittest.TestCase): 18 class GMergeTest(unittest.TestCase):
18 """Test for gmerge.""" 19 """Test for gmerge."""
19 20
20 def setUp(self): 21 def setUp(self):
21 self.lsb_release_lines = [ 22 self.lsb_release_lines = [
22 'CHROMEOS_RELEASE_BOARD=x86-mario\r\n', 23 'CHROMEOS_RELEASE_BOARD=x86-mario\r\n',
23 'CHROMEOS_DEVSERVER=http://localhost:8080/\n'] 24 'CHROMEOS_DEVSERVER=http://localhost:8080/\n']
24 25
25 def testLsbRelease(self): 26 def testLsbRelease(self):
26 merger = gmerge.GMerger(self.lsb_release_lines) 27 merger = gmerge.GMerger(self.lsb_release_lines)
27 self.assertEqual({'CHROMEOS_RELEASE_BOARD': 'x86-mario', 28 self.assertEqual({'CHROMEOS_RELEASE_BOARD': 'x86-mario',
28 'CHROMEOS_DEVSERVER': 'http://localhost:8080/'}, 29 'CHROMEOS_DEVSERVER': 'http://localhost:8080/'},
29 merger.lsb_release) 30 merger.lsb_release)
30 31
31 def testPostData(self): 32 def testPostData(self):
32 gmerge.FLAGS = Flags({'use': 'a b c d +e', 33 original_use = os.environ.get('USE', '')
33 'accept_stable': 'blah'}) 34 os.environ['USE'] = 'a b c d +e'
35 gmerge.FLAGS = Flags({'accept_stable': 'blah'})
34 36
35 merger = gmerge.GMerger(self.lsb_release_lines) 37 merger = gmerge.GMerger(self.lsb_release_lines)
36 self.assertEqual( 38 self.assertEqual(
37 'use=a+b+c+d+%2Be&pkg=package_name&board=x86-mario&accept_stable=blah', 39 'use=a+b+c+d+%2Be&pkg=package_name&board=x86-mario&accept_stable=blah',
38 merger.GeneratePackageRequest('package_name')) 40 merger.GeneratePackageRequest('package_name'))
41 os.environ['USE'] = original_use
39 42
40 43
41 if __name__ == '__main__': 44 if __name__ == '__main__':
42 unittest.main() 45 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698