~frankban/juju-quickstart/env-creation-proto

« back to all changes in this revision

Viewing changes to quickstart/tests/helpers.py

  • Committer: Francesco Banconi
  • Date: 2013-10-30 11:41:44 UTC
  • mfrom: (7.1.3 header-fixes)
  • Revision ID: francesco.banconi@canonical.com-20131030114144-bdjrw7d23u23vdxf
File header fixes + pep8.

R=
CC=
https://codereview.appspot.com/19750043

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This file is part of the Juju GUI, which lets users view and manage Juju
2
 
# environments within a graphical interface (https://launchpad.net/juju-gui).
 
1
# This file is part of the Juju Quickstart Plugin, which lets users set up a
 
2
# Juju environment in very few steps (https://launchpad.net/juju-quickstart).
3
3
# Copyright (C) 2013 Canonical Ltd.
4
4
#
5
5
# This program is free software: you can redistribute it and/or modify it under
37
37
    mock_log.assert_has_calls(expected_calls)
38
38
 
39
39
 
40
 
class CallTestsMixin(object):
41
 
    """Easily use the quickstart.utils.call function."""
42
 
 
43
 
    def patch_call(self, retcode, output='', error=''):
44
 
        """Patch the quickstart.utils.call function."""
45
 
        mock_call = mock.Mock(return_value=(retcode, output, error))
46
 
        return mock.patch('quickstart.utils.call', mock_call)
47
 
 
48
 
    def patch_multiple_calls(self, side_effect):
49
 
        """Patch multiple subsequent quickstart.utils.call calls."""
50
 
        mock_call = mock.Mock(side_effect=side_effect)
51
 
        return mock.patch('quickstart.utils.call', mock_call)
52
 
 
53
 
 
54
40
class BundleFileTestsMixin(object):
55
41
    """Shared methods for testing Juju bundle files."""
56
42
 
77
63
        return bundle_file.name
78
64
 
79
65
 
 
66
class CallTestsMixin(object):
 
67
    """Easily use the quickstart.utils.call function."""
 
68
 
 
69
    def patch_call(self, retcode, output='', error=''):
 
70
        """Patch the quickstart.utils.call function."""
 
71
        mock_call = mock.Mock(return_value=(retcode, output, error))
 
72
        return mock.patch('quickstart.utils.call', mock_call)
 
73
 
 
74
    def patch_multiple_calls(self, side_effect):
 
75
        """Patch multiple subsequent quickstart.utils.call calls."""
 
76
        mock_call = mock.Mock(side_effect=side_effect)
 
77
        return mock.patch('quickstart.utils.call', mock_call)
 
78
 
 
79
 
80
80
class EnvFileTestsMixin(object):
81
81
    """Shared methods for testing a Juju environments file."""
82
82