Example #1
0
    def _handleExecuteCommand(self, payload):

        if 'commandID' in payload:
            command = AlloyData.getCommandData(payload['commandID'])
        elif 'variantID' in payload:
            command = AlloyData.getVariantData(payload['variantID'])
        else:
            return False

        if not command:
            return False

        if command['language'] == 'python':
            if command['location'] == 'remote':
                return remoteExec(command['script'])
            else:
                try:
                    conn = nimble.getConnection()
                    conn.runPythonScript(command['script'])
                except Exception, err:
                    print err
                    return False
Example #2
0
 def _handleGetCommandData(self, payload):
     return AlloyData.getCommandData(**payload)
Example #3
0
print 100*'-' + '\n', 'TEST: AlloyData.createCommand()'
newCommand = AlloyData.createCommand(categories[0]['id'], 1)
print newCommand

print 100*'-' + '\n', 'TEST: AlloyData.modifyCommand()'
modifiedCommand = AlloyData.modifyCommand(
    newCommand['id'],
    label=u'Modified Command',
    script=u'test me out\nsome more.',
    language=u'mel'
)
print modifiedCommand

print 100*'-' + '\n', 'TEST: AlloyData.getCommandData()'
commandData = AlloyData.getCommandData(modifiedCommand['id'])
print commandData

print 100*'-' + '\n', 'TEST: AlloyData.getCommands()'
print AlloyData.getCommands(categories[0]['id'])

print 100*'-' + '\n', 'TEST: AlloyData.deleteCommand()'
deletedCommand = AlloyData.deleteCommand(modifiedCommand['id'])
print deletedCommand

print 100*'-' + '\n', 'FINAL STATE TESTS:'
categories = AlloyData.getCategories()
print 'CATEGORIES:', categories

for c in categories:
    print 'COMMANDS(' + c['id'] + '):', AlloyData.getCommands(c['id'])