This change replaces JSON content types for subcloud-backup API calls with multipart content. This aims to keep the uniformity with all other API calls. Test Plan: 1. PASS - Validate that the API is called with multipart content types and all parameters are read by the API. 2. PASS - Validate that the files uploaded for restore_values and backup_values are read by the API. 3. PASS - Repeat steps 1 and 2 for backup create, delete and restore operation. Story: 2010116 Task: 47020 Signed-off-by: Andre Carneiro <Andre.DexheimerCarneiro@windriver.com> Change-Id: Iba4ceab4a541d308ee4f49c1387298828cf02694
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
# Copyright 2015 - StackStorm, Inc.
|
|
# Copyright (c) 2017, 2019, 2021 Wind River Systems, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
import json
|
|
import testtools
|
|
import yaml
|
|
|
|
from dcmanagerclient import utils
|
|
|
|
|
|
ENV_DICT = {'k1': 'abc', 'k2': 123, 'k3': True}
|
|
ENV_STR = json.dumps(ENV_DICT)
|
|
ENV_YAML = yaml.safe_dump(ENV_DICT, default_flow_style=False)
|
|
|
|
|
|
class UtilityTest(testtools.TestCase):
|
|
|
|
def test_load_empty(self):
|
|
self.assertDictEqual(dict(), utils.load_content(None))
|
|
self.assertDictEqual(dict(), utils.load_content(''))
|
|
self.assertDictEqual(dict(), utils.load_content('{}'))
|
|
self.assertListEqual(list(), utils.load_content('[]'))
|
|
|
|
def test_load_json_content(self):
|
|
self.assertDictEqual(ENV_DICT, utils.load_content(ENV_STR))
|
|
|
|
def test_load_yaml_content(self):
|
|
self.assertDictEqual(ENV_DICT, utils.load_content(ENV_YAML))
|