def test_handle_transform(self): """Verify transform is handled by lookup.""" for name, lookup in RUNWAY_LOOKUP_HANDLERS.items(): query = 'NOT_VALID::default=false, transform=bool' result = lookup.handle(query, context=CONTEXT, variables=VARIABLES) self.assertFalse(result, msg='{} lookup should support the ' '"transform" arg.'.format(name))
def test_handle_default(self, runway_context): """Verify default value is handled by lookups.""" lookup_handlers = RUNWAY_LOOKUP_HANDLERS.copy() lookup_handlers.pop('ssm') # requires special testing for _, lookup in lookup_handlers.items(): query = 'NOT_VALID::default=default value' result = lookup.handle(query, context=runway_context, variables=VARIABLES) assert result == 'default value'
def test_handle_default(self): """Verify default value is handled by lookups.""" for name, lookup in RUNWAY_LOOKUP_HANDLERS.items(): query = 'NOT_VALID::default=default value' result = lookup.handle(query, context=CONTEXT, variables=VARIABLES) self.assertEqual(result, 'default value', msg='{} lookup should support the "default" arg ' 'for default values.'.format(name))
def test_handle_transform(self, runway_context): """Verify transform is handled by lookup.""" lookup_handlers = RUNWAY_LOOKUP_HANDLERS.copy() lookup_handlers.pop('ssm') # requires special testing runway_context.env_vars.update(VALUES) for _, lookup in lookup_handlers.items(): query = 'NOT_VALID::default=false, transform=bool' result = lookup.handle(query, context=runway_context, variables=VARIABLES) assert not result
def test_handle_default(self, runway_context: MockRunwayContext) -> None: """Verify default value is handled by lookups.""" lookup_handlers = RUNWAY_LOOKUP_HANDLERS.copy() lookup_handlers.pop("cfn") # requires special testing lookup_handlers.pop("ecr") # requires special testing lookup_handlers.pop("ssm") # requires special testing for _, lookup in lookup_handlers.items(): result = lookup.handle( "NOT_VALID::default=default value", context=runway_context, variables=VARIABLES, ) assert result == "default value"
def test_handle_transform(self, runway_context: MockRunwayContext) -> None: """Verify transform is handled by lookup.""" lookup_handlers = RUNWAY_LOOKUP_HANDLERS.copy() lookup_handlers.pop("cfn") # requires special testing lookup_handlers.pop("ecr") # requires special testing lookup_handlers.pop("ssm") # requires special testing runway_context.env.vars.update(VALUES) for _, lookup in lookup_handlers.items(): result = lookup.handle( "NOT_VALID::default=false, transform=bool", context=runway_context, variables=VARIABLES, ) assert not result