def test_main_sys_args(self):
        self.sys_mock.argv = ['dos.py', 'list']

        shell.main()
        self.shell_mock.assert_called_once_with(['list'])
        self.shell_inst.execute.assert_called_once_with()
        assert self.sys_mock.exit.called is False
    def test_main_devops_error(self):
        err = error.DevopsError('my error')
        self.shell_inst.execute.side_effect = err

        shell.main(['start'])
        self.shell_mock.assert_called_once_with(['start'])
        self.shell_inst.execute.assert_called_once_with()
        self.sys_mock.exit.assert_called_once_with('Error: my error')
Exemple #3
0
#!/usr/bin/env python
#    Copyright 2013 - 2014 Mirantis, Inc.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import os

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "devops.settings")
    from devops import shell

    shell.main()
Exemple #4
0
#!/usr/bin/env python
#    Copyright 2013 - 2014 Mirantis, Inc.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

from os import environ

if __name__ == "__main__":
    environ.setdefault("DJANGO_SETTINGS_MODULE", "devops.settings")
    from devops.shell import main

    main()
 def execute(self, *args):
     return shell.main(args)
Exemple #6
0
 def execute(self, *args):
     return shell.main(args)
    def test_main_exception(self):
        err = ValueError('error')
        self.shell_inst.execute.side_effect = err

        with self.assertRaises(ValueError):
            shell.main(['start'])
 def test_main(self):
     shell.main(['show'])
     self.shell_mock.assert_called_once_with(['show'])
     self.shell_inst.execute.assert_called_once_with()
     assert self.sys_mock.exit.called is False