def test_create_db(self):
        mock_pm = MagicMock(powermanager)
        mock_pm._db = MagicMock()
        mock_pm._db.sql_query.return_value = (True, "", "")
        powermanager._create_db(mock_pm)

        call1 = call(
            'CREATE TABLE IF NOT EXISTS orchestrator_vms(node_name varchar(128) PRIMARY KEY, uuid varchar(128))', True)
        call2 = call(
            'CREATE TABLE IF NOT EXISTS orchestrator_tasks(node_name varchar(128), operation int)', True)
        self.assertEquals(mock_pm._db.sql_query.call_args_list, [call1, call2])
 def test_create_db_error(self):
     mock_pm = MagicMock(powermanager)
     mock_pm._db = MagicMock()
     powermanager._create_db(mock_pm)
     self.assertIn(
         "Error creating INDIGO orchestrator plugin DB", self.log.getvalue())