~andrewjbeach/juju-ci-tools/make-local-patcher

« back to all changes in this revision

Viewing changes to tests/test_assess_bootstrap.py

  • Committer: Christopher Lee
  • Date: 2016-10-30 23:17:23 UTC
  • mfrom: (1697 trunk)
  • mto: This revision was merged to the branch mainline in revision 1698.
  • Revision ID: chris.lee@canonical.com-20161030231723-weuexhcfcp9jkz0i
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        client = Mock()
45
45
        client.attach_mock(Mock(), 'bootstrap')
46
46
        client.attack_mock(Mock(return_value=jes_enabled), 'is_jes_enabled')
 
47
        client.attack_mock(Mock(), 'kill_controller')
47
48
        bs_manager = Mock()
48
49
        bs_manager.attach_mock(client, 'client')
49
50
        bs_manager.attack_mock(Mock(), 'tear_down')
64
65
 
65
66
    def test_thin_booted_context(self):
66
67
        bs_manager = self.make_bs_manager_mock()
67
 
        with patch('assess_bootstrap.tear_down',
68
 
                   autospec=True) as (tear_down_mock):
69
 
            with thin_booted_context(bs_manager):
70
 
                pass
71
 
        tear_down_mock.assert_called_once_with(
72
 
            bs_manager.client, bs_manager.client.is_jes_enabled())
 
68
        with thin_booted_context(bs_manager):
 
69
            pass
73
70
        bs_manager.top_context.assert_called_once_with()
74
71
        bs_manager.bootstrap_context.assert_called_once_with('machines')
75
72
        bs_manager.runtime_context.assert_called_once_with('machines')
 
73
        bs_manager.client.kill_controller.assert_called_once_with()
76
74
        bs_manager.client.bootstrap.assert_called_once_with()
77
75
 
78
76
    def test_thin_booted_context_kwargs(self):
79
77
        bs_manager = self.make_bs_manager_mock(True)
80
 
        with patch('assess_bootstrap.tear_down', autospec=True):
81
 
            with thin_booted_context(bs_manager, alpha='foo', beta='bar'):
82
 
                bs_manager.client.bootstrap.assert_called_once_with(
83
 
                    alpha='foo', beta='bar')
 
78
        with thin_booted_context(bs_manager, alpha='foo', beta='bar'):
 
79
            pass
 
80
        bs_manager.client.bootstrap.assert_called_once_with(
 
81
            alpha='foo', beta='bar')
84
82
 
85
83
 
86
84
class TestParseArgs(TestCase):