Exemplo n.º 1
0
    def test_driver_private_data_delete_all(self):
        test_host, test_id = self._get_driver_test_data()
        details = {"foo": "bar", "tee": "too"}
        api.driver_private_data_update(self.ctxt, test_host, test_id, details)

        api.driver_private_data_delete(self.ctxt, test_host, test_id)

        actual_result = api.driver_private_data_get(
            self.ctxt, test_host, test_id)

        self.assertEqual({}, actual_result)
Exemplo n.º 2
0
    def test_driver_private_data_update_with_duplicate(self):
        test_host, test_id = self._get_driver_test_data()
        details = {"tee": "too"}

        api.driver_private_data_update(self.ctxt, test_host, test_id, details)
        api.driver_private_data_update(self.ctxt, test_host, test_id, details)

        actual_result = api.driver_private_data_get(
            self.ctxt, test_host, test_id)

        self.assertEqual(details, actual_result)
Exemplo n.º 3
0
    def test_driver_private_data_update(self, details, valid):
        test_host, test_id = self._get_driver_test_data()

        initial_data = api.driver_private_data_get(
            self.ctxt, test_host, test_id)
        api.driver_private_data_update(self.ctxt, test_host, test_id, details)
        actual_data = api.driver_private_data_get(
            self.ctxt, test_host, test_id)

        self.assertEqual({}, initial_data)
        self.assertEqual(valid, actual_data)
Exemplo n.º 4
0
    def test_driver_private_data_delete_single(self):
        test_host, test_id = self._get_driver_test_data()
        test_key = "foo"
        details = {test_key: "bar", "tee": "too"}
        valid_result = {"tee": "too"}
        api.driver_private_data_update(self.ctxt, test_host, test_id, details)

        api.driver_private_data_delete(self.ctxt, test_host, test_id, test_key)

        actual_result = api.driver_private_data_get(
            self.ctxt, test_host, test_id)

        self.assertEqual(valid_result, actual_result)
Exemplo n.º 5
0
    def test_driver_private_data_update_with_delete_existing(self):
        test_host, test_id = self._get_driver_test_data()
        details = {"key1": "val1", "key2": "val2", "key3": "val3"}
        details_update = {"key1": "val1_upd", "key4": "new_val"}

        # Create new details
        api.driver_private_data_update(self.ctxt, test_host, test_id, details)
        api.driver_private_data_update(self.ctxt, test_host, test_id,
                                       details_update, delete_existing=True)

        actual_result = api.driver_private_data_get(
            self.ctxt, test_host, test_id)

        self.assertEqual(details_update, actual_result)
Exemplo n.º 6
0
    def test_driver_private_data_get(self):
        test_host, test_id = self._get_driver_test_data()
        test_key = "foo"
        test_keys = [test_key, "tee"]
        details = {test_keys[0]: "val", test_keys[1]: "val", "mee": "foo"}
        api.driver_private_data_update(self.ctxt, test_host, test_id, details)

        actual_result_all = api.driver_private_data_get(
            self.ctxt, test_host, test_id)
        actual_result_single_key = api.driver_private_data_get(
            self.ctxt, test_host, test_id, test_key)
        actual_result_list = api.driver_private_data_get(
            self.ctxt, test_host, test_id, test_keys)

        self.assertEqual(details, actual_result_all)
        self.assertEqual(details[test_key], actual_result_single_key)
        self.assertEqual(dict.fromkeys(test_keys, "val"), actual_result_list)