コード例 #1
0
ファイル: test_cells.py プロジェクト: Cloudxtreme/craton
 def test_cell_data_update_does_create_variables(self):
     dbapi.cells_create(self.context, cell1)
     res = dbapi.cells_get_by_name(self.context, cell1['region_id'],
                                   cell1['name'])
     self.assertEqual(res.variables, {})
     variables = {"key1": "value1", "key2": "value2"}
     res = dbapi.cells_data_update(self.context, res.id, variables)
     self.assertEqual(res.variables, variables)
コード例 #2
0
ファイル: test_cells.py プロジェクト: Cloudxtreme/craton
    def test_cell_delete(self):
        dbapi.cells_create(self.context, cell1)
        # First make sure we have the cell
        res = dbapi.cells_get_by_name(self.context, cell1['region_id'],
                                      cell1['name'])
        self.assertEqual(res.name, 'cell1')

        dbapi.cells_delete(self.context, res.id)
        self.assertRaises(exceptions.NotFound, dbapi.cells_get_by_name,
                          self.context, 'fake-region', 'fake-cell')
コード例 #3
0
ファイル: test_cells.py プロジェクト: Cloudxtreme/craton
 def test_cell_data_delete(self):
     dbapi.cells_create(self.context, cell1)
     res = dbapi.cells_get_by_name(self.context, cell1['region_id'],
                                   cell1['name'])
     self.assertEqual(res.variables, {})
     variables = {"key1": "value1", "key2": "value2"}
     res = dbapi.cells_data_update(self.context, res.id, variables)
     self.assertEqual(res.variables, variables)
     # NOTE(sulo): we delete variables by their key
     res = dbapi.cells_data_delete(self.context, res.id, {"key1": "key1"})
     self.assertEqual(res.variables, {"key2": "value2"})
コード例 #4
0
ファイル: test_cells.py プロジェクト: Cloudxtreme/craton
 def test_cell_get_by_name(self):
     dbapi.cells_create(self.context, cell1)
     res = dbapi.cells_get_by_name(self.context, cell1['region_id'],
                                   cell1['name'])
     self.assertEqual(res.name, 'cell1')
コード例 #5
0
ファイル: test_cells.py プロジェクト: Cloudxtreme/craton
 def test_cells_get_all(self):
     dbapi.cells_create(self.context, cell1)
     res = dbapi.cells_get_all(self.context, cell1['region_id'])
     self.assertEqual(len(res), 1)
     self.assertEqual(res[0]['name'], 'cell1')
コード例 #6
0
ファイル: test_cells.py プロジェクト: Cloudxtreme/craton
 def test_cells_create(self):
     try:
         dbapi.cells_create(self.context, cell1)
     except Exception:
         self.fail("Cell create raised unexpected exception")