Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/hg/test/update_issues.py

Issue 29343042: Noissue - fix brittle tests of update_issues.py (Closed)
Patch Set: Created May 25, 2016, 3:19 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« 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 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 def _create_mock_milestone_multicall(self): 56 def _create_mock_milestone_multicall(self):
57 ret = [] 57 ret = []
58 multicall = mock.Mock(return_value=ret) 58 multicall = mock.Mock(return_value=ret)
59 multicall.ticket.milestone.get = lambda i: ret.append(MILESTONES[i]) 59 multicall.ticket.milestone.get = lambda i: ret.append(MILESTONES[i])
60 return multicall 60 return multicall
61 61
62 def _mock_trac(self): 62 def _mock_trac(self):
63 trac = mock.Mock() 63 trac = mock.Mock()
64 trac.ticket.get = lambda i: [i, mock.ANY, mock.ANY, ISSUES[i]['attrs']] 64 trac.ticket.get = lambda i: [i, mock.ANY, mock.ANY, ISSUES[i]['attrs']]
65 trac.ticket.getActions = lambda i: ISSUES[i]['actions'] 65 trac.ticket.getActions = lambda i: ISSUES[i]['actions']
66 trac.ticket.milestone.getAll = lambda: MILESTONES.keys() 66 trac.ticket.milestone.getAll = lambda: sorted(MILESTONES.keys())
67 self.trac_proxy_mock = trac 67 self.trac_proxy_mock = trac
68 self._patchWith('xmlrpclib.ServerProxy', trac) 68 self._patchWith('xmlrpclib.ServerProxy', trac)
69 self._patchWith('xmlrpclib.MultiCall', 69 self._patchWith('xmlrpclib.MultiCall',
70 self._create_mock_milestone_multicall()) 70 self._create_mock_milestone_multicall())
71 71
72 def _mock_config(self): 72 def _mock_config(self):
73 config = ConfigParser.ConfigParser() 73 config = ConfigParser.ConfigParser()
74 config.add_section('hg') 74 config.add_section('hg')
75 config.set('hg', 'trac_xmlrpc_url', 'foo') 75 config.set('hg', 'trac_xmlrpc_url', 'foo')
76 config.set('hg', 'issue_url_template', '#{id}') 76 config.set('hg', 'issue_url_template', '#{id}')
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 def test_fix_nonexistent(self): 208 def test_fix_nonexistent(self):
209 self._run_hook(['Fixes 7331 - Foo'], warning_count=1) 209 self._run_hook(['Fixes 7331 - Foo'], warning_count=1)
210 210
211 def test_fix_closed_with_assigned_milestone(self): 211 def test_fix_closed_with_assigned_milestone(self):
212 self._run_hook(['fixes 3559 - Foo']) # No updates. 212 self._run_hook(['fixes 3559 - Foo']) # No updates.
213 213
214 214
215 if __name__ == '__main__': 215 if __name__ == '__main__':
216 unittest.main() 216 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