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

Side by Side Diff: cros_mark_as_stable_unittest.py

Issue 5172003: The major change is refactoring to make functions more accessible for other modules. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Move to using --dry-run Created 10 years, 1 month 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
« cros_mark_as_stable.py ('K') | « cros_mark_as_stable.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 cros_mark_as_stable.py.""" 7 """Unit tests for cros_mark_as_stable.py."""
8 8
9 9 import fileinput
10 import mox 10 import mox
11 import os 11 import os
12 import sys 12 import sys
13 import unittest 13 import unittest
14 14
15 # Required to include '.' in the python path. 15 # Required to include '.' in the python path.
16 sys.path.append(os.path.dirname(__file__)) 16 sys.path.append(os.path.dirname(__file__))
17 import cros_mark_as_stable 17 import cros_mark_as_stable
18 18
19 class GitBranchTest(mox.MoxTestBase): 19 class GitBranchTest(mox.MoxTestBase):
20 20
21 def setUp(self): 21 def setUp(self):
22 mox.MoxTestBase.setUp(self) 22 mox.MoxTestBase.setUp(self)
23 # Always stub RunCommmand out as we use it in every method. 23 # Always stub RunCommmand out as we use it in every method.
24 self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand') 24 self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand')
25 self._branch = 'test_branch' 25 self._branch = 'test_branch'
26 self._tracking_branch = 'cros/test'
26 27
27 def testCreateBranchNoPrevious(self): 28 def testCreateBranchNoPrevious(self):
28 # Test init with no previous branch existing. 29 # Test init with no previous branch existing.
29 branch = cros_mark_as_stable._GitBranch(self._branch) 30 branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
30 self.mox.StubOutWithMock(branch, 'Exists') 31 self.mox.StubOutWithMock(branch, 'Exists')
31 self.mox.StubOutWithMock(branch, '_Checkout') 32 self.mox.StubOutWithMock(branch, '_Checkout')
32 branch.Exists().AndReturn(False) 33 branch.Exists().AndReturn(False)
33 branch._Checkout(self._branch) 34 branch._Checkout(self._branch)
34 self.mox.ReplayAll() 35 self.mox.ReplayAll()
35 branch.CreateBranch() 36 branch.CreateBranch()
36 self.mox.VerifyAll() 37 self.mox.VerifyAll()
37 38
38 def testCreateBranchWithPrevious(self): 39 def testCreateBranchWithPrevious(self):
39 # Test init with previous branch existing. 40 # Test init with previous branch existing.
40 branch = cros_mark_as_stable._GitBranch(self._branch) 41 branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
41 self.mox.StubOutWithMock(branch, 'Exists') 42 self.mox.StubOutWithMock(branch, 'Exists')
42 self.mox.StubOutWithMock(branch, 'Delete') 43 self.mox.StubOutWithMock(branch, 'Delete')
43 self.mox.StubOutWithMock(branch, '_Checkout') 44 self.mox.StubOutWithMock(branch, '_Checkout')
44 branch.Exists().AndReturn(True) 45 branch.Exists().AndReturn(True)
45 branch.Delete() 46 branch.Delete()
46 branch._Checkout(self._branch) 47 branch._Checkout(self._branch)
47 self.mox.ReplayAll() 48 self.mox.ReplayAll()
48 branch.CreateBranch() 49 branch.CreateBranch()
49 self.mox.VerifyAll() 50 self.mox.VerifyAll()
50 51
51 def testCheckoutCreate(self): 52 def testCheckoutCreate(self):
52 # Test init with no previous branch existing. 53 # Test init with no previous branch existing.
53 cros_mark_as_stable._SimpleRunCommand( 54 cros_mark_as_stable._SimpleRunCommand(
54 'git checkout -b %s cros/master' % self._branch) 55 'git checkout -b %s %s' % (self._branch, self._tracking_branch))
55 self.mox.ReplayAll() 56 self.mox.ReplayAll()
56 branch = cros_mark_as_stable._GitBranch(self._branch) 57 branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
57 branch._Checkout(self._branch) 58 branch._Checkout(self._branch)
58 self.mox.VerifyAll() 59 self.mox.VerifyAll()
59 60
60 def testCheckoutNoCreate(self): 61 def testCheckoutNoCreate(self):
61 # Test init with previous branch existing. 62 # Test init with previous branch existing.
62 cros_mark_as_stable._SimpleRunCommand('git checkout cros/master') 63 cros_mark_as_stable._SimpleRunCommand('git checkout %s' % (
64 self._tracking_branch))
63 self.mox.ReplayAll() 65 self.mox.ReplayAll()
64 branch = cros_mark_as_stable._GitBranch(self._branch) 66 branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
65 branch._Checkout('cros/master', False) 67 branch._Checkout(self._tracking_branch, False)
66 self.mox.VerifyAll() 68 self.mox.VerifyAll()
67 69
68 def testDelete(self): 70 def testDelete(self):
69 branch = cros_mark_as_stable._GitBranch(self._branch) 71 branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
70 self.mox.StubOutWithMock(branch, '_Checkout') 72 self.mox.StubOutWithMock(branch, '_Checkout')
71 branch._Checkout('cros/master', create=False) 73 branch._Checkout(self._tracking_branch, create=False)
72 cros_mark_as_stable._SimpleRunCommand('git branch -D ' + self._branch) 74 cros_mark_as_stable._SimpleRunCommand('git branch -D ' + self._branch)
73 self.mox.ReplayAll() 75 self.mox.ReplayAll()
74 branch.Delete() 76 branch.Delete()
75 self.mox.VerifyAll() 77 self.mox.VerifyAll()
76 78
77 def testExists(self): 79 def testExists(self):
78 branch = cros_mark_as_stable._GitBranch(self._branch) 80 branch = cros_mark_as_stable.GitBranch(self._branch, self._tracking_branch)
79 81
80 # Test if branch exists that is created 82 # Test if branch exists that is created
81 cros_mark_as_stable._SimpleRunCommand('git branch').AndReturn( 83 cros_mark_as_stable._SimpleRunCommand('git branch').AndReturn(
82 '%s %s' % (self._branch, 'cros/master')) 84 '%s %s' % (self._branch, self._tracking_branch))
83 self.mox.ReplayAll() 85 self.mox.ReplayAll()
84 self.assertTrue(branch.Exists()) 86 self.assertTrue(branch.Exists())
85 self.mox.VerifyAll() 87 self.mox.VerifyAll()
86 88
87 89
88 class EBuildTest(mox.MoxTestBase): 90 class EBuildTest(mox.MoxTestBase):
89 91
90 def setUp(self): 92 def setUp(self):
91 mox.MoxTestBase.setUp(self) 93 mox.MoxTestBase.setUp(self)
92 94
93 def testInit(self):
94 self.mox.StubOutWithMock(cros_mark_as_stable._EBuild, '_ParseEBuildPath')
95
96 ebuild_path = '/overlay/cat/test_package/test_package-0.0.1-r1.ebuild'
97 cros_mark_as_stable._EBuild._ParseEBuildPath(
98 ebuild_path).AndReturn(['/overlay/cat/test_package-0.0.1',
99 '/overlay/cat/test_package',
100 1])
101 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input')
102 mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id',
103 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}']
104 cros_mark_as_stable.fileinput.input(ebuild_path).AndReturn(mock_file)
105
106 self.mox.ReplayAll()
107 ebuild = cros_mark_as_stable._EBuild(ebuild_path)
108 self.mox.VerifyAll()
109 self.assertEquals(ebuild.package, 'cat/test_package')
110 self.assertEquals(ebuild.ebuild_path, ebuild_path)
111 self.assertEquals(ebuild.ebuild_path_no_revision,
112 '/overlay/cat/test_package-0.0.1')
113 self.assertEquals(ebuild.ebuild_path_no_version,
114 '/overlay/cat/test_package')
115 self.assertEquals(ebuild.current_revision, 1)
116
117 def testParseEBuildPath(self): 95 def testParseEBuildPath(self):
118 # Test with ebuild with revision number. 96 # Test with ebuild with revision number.
119 no_rev, no_version, revision = cros_mark_as_stable._EBuild._ParseEBuildPath( 97 fake_ebuild_path = '/path/to/test_package/test_package-0.0.1-r1.ebuild'
120 '/path/test_package-0.0.1-r1.ebuild') 98 self.mox.StubOutWithMock(fileinput, 'input')
121 self.assertEquals(no_rev, '/path/test_package-0.0.1') 99 fileinput.input(fake_ebuild_path).AndReturn('')
122 self.assertEquals(no_version, '/path/test_package') 100 self.mox.ReplayAll()
123 self.assertEquals(revision, 1) 101 fake_ebuild = cros_mark_as_stable.EBuild(fake_ebuild_path)
102 self.mox.VerifyAll()
103 self.assertEquals(fake_ebuild.ebuild_path_no_revision,
104 '/path/to/test_package/test_package-0.0.1')
105 self.assertEquals(fake_ebuild.ebuild_path_no_version,
106 '/path/to/test_package/test_package')
107 self.assertEquals(fake_ebuild.current_revision, 1)
124 108
125 def testParseEBuildPathNoRevisionNumber(self): 109 def testParseEBuildPathNoRevisionNumber(self):
126 # Test with ebuild without revision number. 110 # Test with ebuild without revision number.
127 no_rev, no_version, revision = cros_mark_as_stable._EBuild._ParseEBuildPath( 111 fake_ebuild_path = '/path/to/test_package/test_package-9999.ebuild'
128 '/path/test_package-9999.ebuild') 112 self.mox.StubOutWithMock(fileinput, 'input')
129 self.assertEquals(no_rev, '/path/test_package-0.0.1') 113 fileinput.input(fake_ebuild_path).AndReturn('')
130 self.assertEquals(no_version, '/path/test_package') 114 self.mox.ReplayAll()
131 self.assertEquals(revision, 0) 115 fake_ebuild = cros_mark_as_stable.EBuild(fake_ebuild_path)
116 self.mox.VerifyAll()
117
118 self.assertEquals(fake_ebuild.ebuild_path_no_revision,
119 '/path/to/test_package/test_package-9999')
120 self.assertEquals(fake_ebuild.ebuild_path_no_version,
121 '/path/to/test_package/test_package')
122 self.assertEquals(fake_ebuild.current_revision, 0)
132 123
133 124
134 class EBuildStableMarkerTest(mox.MoxTestBase): 125 class EBuildStableMarkerTest(mox.MoxTestBase):
135 126
136 def setUp(self): 127 def setUp(self):
137 mox.MoxTestBase.setUp(self) 128 mox.MoxTestBase.setUp(self)
138 self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand') 129 self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand')
139 self.mox.StubOutWithMock(cros_mark_as_stable, 'RunCommand') 130 self.mox.StubOutWithMock(cros_mark_as_stable, 'RunCommand')
140 self.mox.StubOutWithMock(os, 'unlink') 131 self.mox.StubOutWithMock(os, 'unlink')
141 self.m_ebuild = self.mox.CreateMock(cros_mark_as_stable._EBuild) 132 self.m_ebuild = self.mox.CreateMock(cros_mark_as_stable.EBuild)
142 self.m_ebuild.is_stable = True 133 self.m_ebuild.is_stable = True
143 self.m_ebuild.package = 'test_package' 134 self.m_ebuild.package = 'test_package'
144 self.m_ebuild.current_revision = 1 135 self.m_ebuild.current_revision = 1
145 self.m_ebuild.ebuild_path_no_revision = '/path/test_package-0.0.1' 136 self.m_ebuild.ebuild_path_no_revision = '/path/test_package-0.0.1'
146 self.m_ebuild.ebuild_path_no_version = '/path/test_package' 137 self.m_ebuild.ebuild_path_no_version = '/path/test_package'
147 self.m_ebuild.ebuild_path = '/path/test_package-0.0.1-r1.ebuild' 138 self.m_ebuild.ebuild_path = '/path/test_package-0.0.1-r1.ebuild'
148 self.revved_ebuild_path = '/path/test_package-0.0.1-r2.ebuild' 139 self.revved_ebuild_path = '/path/test_package-0.0.1-r2.ebuild'
149 140
150 def testRevEBuild(self): 141 def testRevWorkOnEBuild(self):
151 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') 142 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input')
152 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists') 143 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists')
153 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') 144 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile')
154 m_file = self.mox.CreateMock(file) 145 m_file = self.mox.CreateMock(file)
155 146
156 # Prepare mock fileinput. This tests to make sure both the commit id 147 # Prepare mock fileinput. This tests to make sure both the commit id
157 # and keywords are changed correctly. 148 # and keywords are changed correctly.
158 mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id', 149 mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id',
159 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}'] 150 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}']
160 151
161 ebuild_9999 = self.m_ebuild.ebuild_path_no_version + '-9999.ebuild' 152 ebuild_9999 = self.m_ebuild.ebuild_path_no_version + '-9999.ebuild'
162 cros_mark_as_stable.os.path.exists(ebuild_9999).AndReturn(True) 153 cros_mark_as_stable.os.path.exists(ebuild_9999).AndReturn(True)
163 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path) 154 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path)
164 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path, 155 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path,
165 inplace=1).AndReturn(mock_file) 156 inplace=1).AndReturn(mock_file)
166 m_file.write('EAPI=2') 157 m_file.write('EAPI=2')
167 m_file.write('CROS_WORKON_COMMIT="my_id"\n') 158 m_file.write('CROS_WORKON_COMMIT="my_id"\n')
168 m_file.write('KEYWORDS="x86 arm"') 159 m_file.write('KEYWORDS="x86 arm"')
169 m_file.write('src_unpack(){}') 160 m_file.write('src_unpack(){}')
170 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, 161 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path,
171 self.revved_ebuild_path] 162 self.revved_ebuild_path]
172 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, 163 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True,
173 print_cmd=False, redirect_stderr=True, 164 print_cmd=False, redirect_stderr=True,
174 redirect_stdout=True).AndReturn(1) 165 redirect_stdout=True).AndReturn(1)
175 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path) 166 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path)
176 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path) 167 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path)
177 168
178 self.mox.ReplayAll() 169 self.mox.ReplayAll()
179 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) 170 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild)
180 marker.RevEBuild('my_id', redirect_file=m_file) 171 marker.RevWorkOnEBuild('my_id', redirect_file=m_file)
181 self.mox.VerifyAll() 172 self.mox.VerifyAll()
182 173
183 def testRevUnchangedEBuild(self): 174 def testRevUnchangedEBuild(self):
184 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') 175 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input')
185 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists') 176 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists')
186 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') 177 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile')
187 m_file = self.mox.CreateMock(file) 178 m_file = self.mox.CreateMock(file)
188 179
189 # Prepare mock fileinput. This tests to make sure both the commit id 180 # Prepare mock fileinput. This tests to make sure both the commit id
190 # and keywords are changed correctly. 181 # and keywords are changed correctly.
(...skipping 11 matching lines...) Expand all
202 m_file.write('src_unpack(){}') 193 m_file.write('src_unpack(){}')
203 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, 194 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path,
204 self.revved_ebuild_path] 195 self.revved_ebuild_path]
205 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, 196 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True,
206 print_cmd=False, redirect_stderr=True, 197 print_cmd=False, redirect_stderr=True,
207 redirect_stdout=True).AndReturn(0) 198 redirect_stdout=True).AndReturn(0)
208 cros_mark_as_stable.os.unlink(self.revved_ebuild_path) 199 cros_mark_as_stable.os.unlink(self.revved_ebuild_path)
209 200
210 self.mox.ReplayAll() 201 self.mox.ReplayAll()
211 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) 202 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild)
212 marker.RevEBuild('my_id', redirect_file=m_file) 203 marker.RevWorkOnEBuild('my_id', redirect_file=m_file)
213 self.mox.VerifyAll() 204 self.mox.VerifyAll()
214 205
215 def testRevMissingEBuild(self): 206 def testRevMissingEBuild(self):
216 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') 207 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input')
217 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists') 208 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists')
218 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') 209 self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile')
219 self.mox.StubOutWithMock(cros_mark_as_stable, 'Die') 210 self.mox.StubOutWithMock(cros_mark_as_stable, 'Die')
220 m_file = self.mox.CreateMock(file) 211 m_file = self.mox.CreateMock(file)
221 212
222 # Prepare mock fileinput. This tests to make sure both the commit id 213 # Prepare mock fileinput. This tests to make sure both the commit id
223 # and keywords are changed correctly. 214 # and keywords are changed correctly.
224 mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id', 215 mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id',
225 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}'] 216 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}']
226 217
227 ebuild_9999 = self.m_ebuild.ebuild_path_no_version + '-9999.ebuild' 218 ebuild_9999 = self.m_ebuild.ebuild_path_no_version + '-9999.ebuild'
228 cros_mark_as_stable.os.path.exists(ebuild_9999).AndReturn(False) 219 cros_mark_as_stable.os.path.exists(ebuild_9999).AndReturn(False)
229 cros_mark_as_stable.Die("Missing 9999 ebuild: %s" % ebuild_9999) 220 cros_mark_as_stable.Die("Missing unstable ebuild: %s" % ebuild_9999)
230 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path) 221 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path)
231 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path, 222 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path,
232 inplace=1).AndReturn(mock_file) 223 inplace=1).AndReturn(mock_file)
233 m_file.write('EAPI=2') 224 m_file.write('EAPI=2')
234 m_file.write('CROS_WORKON_COMMIT="my_id"\n') 225 m_file.write('CROS_WORKON_COMMIT="my_id"\n')
235 m_file.write('KEYWORDS="x86 arm"') 226 m_file.write('KEYWORDS="x86 arm"')
236 m_file.write('src_unpack(){}') 227 m_file.write('src_unpack(){}')
237 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, 228 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path,
238 self.revved_ebuild_path] 229 self.revved_ebuild_path]
239 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, 230 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True,
240 print_cmd=False, redirect_stderr=True, 231 print_cmd=False, redirect_stderr=True,
241 redirect_stdout=True).AndReturn(1) 232 redirect_stdout=True).AndReturn(1)
242 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path) 233 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path)
243 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path) 234 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path)
244 235
245 self.mox.ReplayAll() 236 self.mox.ReplayAll()
246 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) 237 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild)
247 marker.RevEBuild('my_id', redirect_file=m_file) 238 marker.RevWorkOnEBuild('my_id', redirect_file=m_file)
248 self.mox.VerifyAll() 239 self.mox.VerifyAll()
249 240
250 241
251 def testCommitChange(self): 242 def testCommitChange(self):
252 mock_message = 'Commit me' 243 mock_message = 'Commit me'
253 cros_mark_as_stable._SimpleRunCommand( 244 cros_mark_as_stable._SimpleRunCommand(
254 'git commit -am "%s"' % mock_message) 245 'git commit -am "%s"' % mock_message)
255 self.mox.ReplayAll() 246 self.mox.ReplayAll()
256 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) 247 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild)
257 marker.CommitChange(mock_message) 248 marker.CommitChange(mock_message)
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 cros_mark_as_stable._FindUprevCandidates([]).AndReturn(package) 292 cros_mark_as_stable._FindUprevCandidates([]).AndReturn(package)
302 self.mox.ReplayAll() 293 self.mox.ReplayAll()
303 cros_mark_as_stable._BuildEBuildDictionary(overlays, False, []) 294 cros_mark_as_stable._BuildEBuildDictionary(overlays, False, [])
304 self.assertEquals(len(overlays), 1) 295 self.assertEquals(len(overlays), 1)
305 self.assertEquals(overlays["/overlay"], []) 296 self.assertEquals(overlays["/overlay"], [])
306 self.mox.VerifyAll() 297 self.mox.VerifyAll()
307 298
308 299
309 if __name__ == '__main__': 300 if __name__ == '__main__':
310 unittest.main() 301 unittest.main()
OLDNEW
« cros_mark_as_stable.py ('K') | « cros_mark_as_stable.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698