def test_node_update(self): db.drop_table(Node) data = dict(hostname='192.168.1.1', user='******', password='******', port=22, paxos_home='/home/paxos/PAXOS', id=1) rv, rdata = self._put('/api/node/1', dict(node=data)) self.assertEqual(rv.status_code, 500) self.assertTrue('error' in rdata)
def test_cell_list(self): db.drop_table(Cell) rv = self.app.get('/api/cell') self.assertEqual(rv.mimetype, 'application/json') self.assertEqual(rv.status_code, 500) rdata = json.loads(rv.data) self.assertTrue('error' in rdata)
def test_node_delete(self): db.drop_table(Node) rv = self.app.delete('/api/node/1') self.assertEqual(rv.mimetype, 'application/json') rdata = json.loads(rv.data) self.assertEqual(rv.status_code, 500) self.assertTrue('error' in rdata)
def test_cell_update(self): db.drop_table(Cell) data = dict(name='cmdb0', type='CMDB', comment='comment', nodes=[]) rv, rdata = self._put('/api/cell/1', dict(cell=data)) self.assertEqual(rv.mimetype, 'application/json') self.assertEqual(rv.status_code, 500) rdata = json.loads(rv.data) self.assertTrue('error' in rdata)
def test_cell_create2(self): db.drop_table(CellNode) nodes = [self._create_node('192.168.1.1'), self._create_node('192.168.1.2'), self._create_node('192.168.1.3')] data = dict(name='cmdb0', type='CMDB', comment='comment', nodes=[]) no = 0 for node in nodes: cnode = dict(no=no, node=node['id'], tcp_addr=node['hostname'], udp_addr=node['hostname'], tcp_port=14000, udp_port=14000) no = no + 1 data['nodes'].append(cnode) rv, rdata = self._post('/api/cell', dict(cell=data)) self.assertEqual(rv.mimetype, 'application/json') self.assertEqual(rv.status_code, 500) rdata = json.loads(rv.data) self.assertTrue('error' in rdata)
def tearDown(self): db.drop_table(CellNode, fail_silently=True) db.drop_table(Node, fail_silently=True) db.drop_table(Cell, fail_silently=True)
def tearDownClass(cls): db.drop_table(CellNode) db.drop_table(Node) db.drop_table(Cell)
def create_tables(tables): for tbl in tables: db.drop_table(tbl, fail_silently=True) db.create_tables(tables)