Esempio n. 1
0
    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
Esempio n. 2
0
    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')
Esempio n. 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()
Esempio n. 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()
Esempio n. 5
0
 def execute(self, *args):
     return shell.main(args)
Esempio n. 6
0
 def execute(self, *args):
     return shell.main(args)
Esempio n. 7
0
    def test_main_exception(self):
        err = ValueError('error')
        self.shell_inst.execute.side_effect = err

        with self.assertRaises(ValueError):
            shell.main(['start'])
Esempio n. 8
0
 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