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

« back to all changes in this revision

Viewing changes to tests/test_assess_min_version.py

  • Committer: Curtis Hovey
  • Date: 2016-06-15 20:52:35 UTC
  • Revision ID: curtis@canonical.com-20160615205235-cf6hu9xt1qmbo1a4
Escape vars in run-unit-tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
    def test_main(self):
49
49
        argv = ["an-env", "/bin/juju", "/tmp/logs", "an-env-mod", "--verbose"]
 
50
        env = object()
50
51
        client = Mock(spec=["is_jes_enabled"])
51
52
        with patch("assess_min_version.configure_logging",
52
53
                   autospec=True) as mock_cl:
53
54
            with patch("assess_min_version.BootstrapManager.booted_context",
54
55
                       autospec=True) as mock_bc:
55
 
                with patch("deploy_stack.client_from_config",
56
 
                           return_value=client) as mock_c:
57
 
                    with patch("assess_min_version.assess_min_version",
58
 
                               autospec=True) as mock_assess:
59
 
                        main(argv)
 
56
                with patch("jujupy.SimpleEnvironment.from_config",
 
57
                           return_value=env) as mock_e:
 
58
                    with patch("jujupy.EnvJujuClient.by_version",
 
59
                               return_value=client) as mock_c:
 
60
                        with patch("assess_min_version.assess_min_version",
 
61
                                   autospec=True) as mock_assess:
 
62
                            main(argv)
60
63
        mock_cl.assert_called_once_with(logging.DEBUG)
61
 
        mock_c.assert_called_once_with('an-env', "/bin/juju", debug=False,
62
 
                                       soft_deadline=None)
 
64
        mock_e.assert_called_once_with("an-env")
 
65
        mock_c.assert_called_once_with(env, "/bin/juju", debug=False)
63
66
        self.assertEqual(mock_bc.call_count, 1)
64
67
        mock_assess.assert_called_once_with(client)
65
68