def test_create_associated_triggers(self): workbook = {'name': 'my_workbook', 'definition': self.doc} scheduler.create_associated_triggers(workbook) triggers = db_api.triggers_get(workbook_name='my_workbook') self.assertEqual(triggers[0]['name'], 'create-vms') self.assertEqual(triggers[0]['pattern'], '* * * * *') self.assertEqual(triggers[0]['workbook_name'], 'my_workbook')
def test_create_associated_triggers(self): workbook = { 'name': 'my_workbook', 'definition': self.doc } scheduler.create_associated_triggers(workbook) triggers = db_api.triggers_get(workbook_name='my_workbook') self.assertEqual(triggers[0]['name'], 'create-vms') self.assertEqual(triggers[0]['pattern'], '* * * * *') self.assertEqual(triggers[0]['workbook_name'], 'my_workbook')
def test_put(self): resp = self.app.put('/v1/workbooks/my_workbook/definition', NEW_DEFINITION, headers={"Content-Type": "text/plain"}) self.assertEqual(resp.status_int, 200) self.assertEqual(NEW_DEFINITION, resp.body) # Check that associated triggers have been created in DB. triggers = db_api.triggers_get(workbook_name='my_workbook') self.assertEqual(triggers[0]['name'], 'create-vms') self.assertEqual(triggers[0]['pattern'], '* * * * *') self.assertEqual(triggers[0]['workbook_name'], 'my_workbook')