Beispiel #1
0
 def test_cli_utility(self):
     zappa_cli = ZappaCLI()
     zappa_cli.api_stage = 'ttt888'
     zappa_cli.load_settings('test_settings.json')
     zappa_cli.create_package()
     zappa_cli.remove_local_zip()
     logs = [
         {
             'timestamp': '12345',
             'message': '[START RequestId] test'
         },
         {
             'timestamp': '12345',
             'message': '[REPORT RequestId] test'
         },
         {
             'timestamp': '12345',
             'message': '[END RequestId] test'
         },
         { 
             'timestamp': '12345',
             'message': 'test'
         }
     ]
     zappa_cli.print_logs(logs)
Beispiel #2
0
 def test_cli_utility(self):
     zappa_cli = ZappaCLI()
     zappa_cli.api_stage = 'ttt333'
     zappa_cli.load_settings('test_settings.json')
     zappa_cli.create_package()
     zappa_cli.remove_local_zip()
     logs = [
         {
             'timestamp': '12345',
             'message': '[START RequestId] test'
         },
         {
             'timestamp': '12345',
             'message': '[REPORT RequestId] test'
         },
         {
             'timestamp': '12345',
             'message': '[END RequestId] test'
         },
         { 
             'timestamp': '12345',
             'message': 'test'
         }
     ]
     zappa_cli.print_logs(logs)
Beispiel #3
0
 def test_cli_utility(self):
     zappa_cli = ZappaCLI()
     zappa_cli.api_stage = 'ttt888'
     zappa_cli.load_settings('test_settings.json')
     zappa_cli.create_package()
     zappa_cli.remove_local_zip()
     logs = [
         {
             'timestamp': '12345',
             'message': '[START RequestId] test'
         },
         {
             'timestamp': '12345',
             'message': '[REPORT RequestId] test'
         },
         {
             'timestamp': '12345',
             'message': '[END RequestId] test'
         },
         {
             'timestamp': '12345',
             'message': 'test'
         },
         {
             'timestamp': '1480001341214',
             'message': '[INFO] 2016-11-24T15:29:13.326Z c0cb52d1-b25a-11e6-9b73-f940ce24319a 59.111.125.48 - -  [24/Nov/2016:15:29:13 +0000] "GET / HTTP/1.1" 200 2590 "" "python-requests/2.11.0" 0/4.672'
         },
         {
             'timestamp': '1480001341214',
             'message': '[INFO] 2016-11-24T15:29:13.326Z c0cb52d1-b25a-11e6-9b73-f940ce24319a 59.111.125.48 - -  [24/Nov/2016:15:29:13 +0000] "GET / HTTP/1.1" 400 2590 "" "python-requests/2.11.0" 0/4.672'
         },
         {
             'timestamp': '1480001341215',
             'message': '[1480001341258] [DEBUG] 2016-11-24T15:29:01.258Z b890d8f6-b25a-11e6-b6bc-718f7ec807df Zappa Event: {}'
         }
     ]
     zappa_cli.print_logs(logs)
     zappa_cli.print_logs(logs, colorize=False)
     zappa_cli.print_logs(logs, colorize=False, http=True)
     zappa_cli.print_logs(logs, colorize=True, http=True)
     zappa_cli.print_logs(logs, colorize=True, http=False)
     zappa_cli.check_for_update()
Beispiel #4
0
    def test_remote_env_package(self):
        zappa_cli = ZappaCLI()
        zappa_cli.api_stage = 'depricated_remote_env'
        zappa_cli.load_settings('test_settings.json')
        self.assertEqual('lmbda-env', zappa_cli.stage_config['remote_env_bucket'])
        self.assertEqual('dev/env.json', zappa_cli.stage_config['remote_env_file'])
        zappa_cli.create_package()
        with zipfile.ZipFile(zappa_cli.zip_path, 'r') as lambda_zip:
            content = lambda_zip.read('zappa_settings.py')
        zappa_cli.remove_local_zip()
        m = re.search("REMOTE_ENV='(.*)'", content)
        self.assertEqual(m.group(1), 's3://lmbda-env/dev/env.json')

        zappa_cli = ZappaCLI()
        zappa_cli.api_stage = 'remote_env'
        zappa_cli.load_settings('test_settings.json')
        self.assertEqual('s3://lmbda-env/prod/env.json', zappa_cli.stage_config['remote_env'])
        zappa_cli.create_package()
        with zipfile.ZipFile(zappa_cli.zip_path, 'r') as lambda_zip:
            content = lambda_zip.read('zappa_settings.py')
        zappa_cli.remove_local_zip()
        m = re.search("REMOTE_ENV='(.*)'", content)
        self.assertEqual(m.group(1), 's3://lmbda-env/prod/env.json')