~doanac/ubuntu-ci-services-itself/upgrade-support

« back to all changes in this revision

Viewing changes to lander/lander/tests/test_archiver.py

  • Committer: Chris Johnston
  • Author(s): Evan Dandrea
  • Date: 2014-03-17 06:33:02 UTC
  • mfrom: (400.1.10 time-sorted-tests)
  • Revision ID: chris_johnston-20140317063302-52wct68d41e6qubs
[r=Andy Doan, Chris Johnston, PS Jenkins bot] Shave two minutes off test execution. Add a small program to print sorted test execution time.  from Evan Dandrea

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import os
19
19
import sys
20
20
import unittest
 
21
import urllib2
21
22
 
22
23
sys.path.append(os.path.join(os.path.dirname(__file__), '../../bin'))
23
24
import lander_archiver
245
246
        self.assertEqual(-2, self.archiver())
246
247
 
247
248
    @mock.patch('lander_archiver.TicketApi')
248
 
    def test_call_store_artifact_failure(self, ticket_api):
 
249
    @mock.patch('urllib2.urlopen')
 
250
    def test_call_store_artifact_failure(self, mock_urlopen, ticket_api):
249
251
        '''Verify __call__ returns -3 on a store artifact failure.'''
250
252
        config = {'username', 'user',
251
253
                  'password', 'pass'}
 
254
 
 
255
        def side_effect(*args):
 
256
            # Don't hang around waiting for the Jenkins server to never reply.
 
257
            raise urllib2.URLError('Nope.')
 
258
        mock_urlopen.side_effect = side_effect
252
259
        api_inst = mock.Mock()
253
260
        ticket_api.return_value = api_inst
254
261
        args = mock.Mock()