Exemplo n.º 1
0
 def test_action_invalid_runtime(self):
     action = GenerateAction(default_args())
     action._config = Mock()
     action._config.get_runtime('foo')
     action._config.get_handler_namespace = Mock(return_value='namespace')
     action._config.get_handler_function = Mock(return_value='function')
     action.action()
Exemplo n.º 2
0
 def test_action_invalid_kind(self):
     args = default_args()
     args.kind = 'foo'
     action = GenerateAction(args)
     action._config = Mock()
     action._config.get_runtime = Mock(return_value='python2.7')
     action._config.get_handler_namespace = Mock(return_value='namespace')
     action._config.get_handler_function = Mock(return_value='function')
     action.action()
Exemplo n.º 3
0
    def test_action(self):
        with patch('lamvery.actions.init.confirm_overwrite') as c:
            c.return_value = True
            action = GenerateAction(default_args())
            action._config = Mock()
            action._config.get_runtime = Mock(return_value='python2.7')
            action._config.get_handler_namespace = Mock(return_value='namespace')
            action._config.get_handler_function = Mock(return_value='function')
            action.action()
            eq_(open('namespace.py', 'r').read(), """import lamvery

def function(event, context):
    # Use environment variables
    # lamvery.env.load()
    # print(os.environ['FOO'])

    # Use KMS encryption
    # print(lamvery.secret.get('foo'))

    print('This is a skeleton function.')
""")