예제 #1
0
    def test_cli_init(self):

        if os.path.isfile('zappa_settings.json'):
            os.remove('zappa_settings.json')

        # Test directly
        zappa_cli = ZappaCLI()
        # Via http://stackoverflow.com/questions/2617057/how-to-supply-stdin-files-and-environment-variable-inputs-to-python-unit-tests
        inputs = ['dev', 'lmbda', 'test_settings', '']
        input_generator = (i for i in inputs)
        with mock.patch('__builtin__.raw_input', lambda prompt: next(input_generator)):
            zappa_cli.init()

        if os.path.isfile('zappa_settings.json'):
            os.remove('zappa_settings.json')

        # Test via handle()
        input_generator = (i for i in inputs)
        with mock.patch('__builtin__.raw_input', lambda prompt: next(input_generator)):
            zappa_cli = ZappaCLI()
            argv = ['init']
            zappa_cli.handle(argv)

        if os.path.isfile('zappa_settings.json'):
            os.remove('zappa_settings.json')
예제 #2
0
파일: tests.py 프로젝트: zombiefied/Zappa
 def test_cli_error_exit_code(self):
     # Discussion: https://github.com/Miserlou/Zappa/issues/407
     zappa_cli = ZappaCLI()
     # Sanity
     argv = '-s test_settings.json status devor'.split()
     with self.assertRaises(SystemExit) as system_exit:
         zappa_cli.handle(argv)
     self.assertEqual(system_exit.exception.code, 1)
예제 #3
0
파일: tests.py 프로젝트: yut148/Zappa
    def test_cli_default(self):
        # Discussion: https://github.com/Miserlou/Zappa/issues/422
        zappa_cli = ZappaCLI()
        argv = '-s tests/test_one_env.json status'.split()
        # It'll fail, but at least it'll cover it.
        with self.assertRaises(SystemExit) as system_exit:
            zappa_cli.handle(argv)
        self.assertEqual(system_exit.exception.code, 1)

        zappa_cli = ZappaCLI()
        argv = '-s tests/test_one_env.json status --all'.split()
        # It'll fail, but at least it'll cover it.
        with self.assertRaises(SystemExit) as system_exit:
            zappa_cli.handle(argv)
        self.assertEqual(system_exit.exception.code, 1)

        zappa_cli = ZappaCLI()
        argv = '-s test_settings.json status'.split()
        with self.assertRaises(SystemExit) as system_exit:
            zappa_cli.handle(argv)
        self.assertEqual(system_exit.exception.code, 2)
예제 #4
0
 def test_cli_args(self):
     zappa_cli = ZappaCLI()
     # Sanity
     argv = '-s test_settings.json derp ttt888'.split()
     zappa_cli.handle(argv)
예제 #5
0
 def test_cli_args(self):
     zappa_cli = ZappaCLI()
     # Sanity
     argv = '-s test_settings.json derp ttt888'.split()
     zappa_cli.handle(argv)
예제 #6
0
from zappa.cli import ZappaCLI

zappa = ZappaCLI()

zappa.handle(["update"])
예제 #7
0
from zappa.cli import ZappaCLI

zappa = ZappaCLI()

zappa.handle(["deploy"])