예제 #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
예제 #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')
예제 #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()
예제 #4
0
파일: dos.py 프로젝트: jvalinas/fuel-devops
#!/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()
예제 #5
0
 def execute(self, *args):
     return shell.main(args)
예제 #6
0
 def execute(self, *args):
     return shell.main(args)
예제 #7
0
    def test_main_exception(self):
        err = ValueError('error')
        self.shell_inst.execute.side_effect = err

        with self.assertRaises(ValueError):
            shell.main(['start'])
예제 #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