def test_mkBadParameter(self): with self.assertRaises(AssertionError): Category.mkParameter(name='pname', description='pdesc', datatype='STRING', optional=True # deliberately missing default value )
def test_mkGoodCommandScript(self): p1 = Category.mkParameter(name='venue', description='Where am I today?', datatype='STRING') tvalues = { 'name': 'Hello <venue>', 'description': 'Stereotypical rock star intro', 'platforms': ['LINUX'], 'type': 'COMMAND', 'payload': 'echo "hello $1"', 'parameters': [p1] } actual = Category.mkScript(name=tvalues['name'], description=tvalues['description'], platforms=tvalues['platforms'], execution_type=tvalues['type'], payload=tvalues['payload'], parameters=tvalues['parameters']) expected = { 'name': tvalues['name'], 'description': tvalues['description'], 'platforms': tvalues['platforms'], 'executionType': tvalues['type'], 'command': tvalues['payload'], 'parameters': tvalues['parameters'] } assert actual == expected
def test_mkGoodParameter(self): tvalues = { 'name': 'venue', 'description': 'Where am I today?', 'type': 'STRING' } actual = Category.mkParameter(name=tvalues['name'], description=tvalues['description'], datatype=tvalues['type']) expected = { 'name': tvalues['name'], 'description': tvalues['description'], 'dataType': tvalues['type'], 'type': 'REQUIRED', 'defaultValue': None } assert actual == expected