diff options
author | 2020-07-21 15:14:27 -0700 | |
---|---|---|
committer | 2020-07-21 15:15:34 -0700 | |
commit | 9df81b14e7203d6c3911f5f36881cb5170afdccc (patch) | |
tree | 2a9b5e913e83d0f21b374f068c53df266d3dec56 /onap-client/onap_client/tests/test_resource.py | |
parent | b3e7a9fbcbf52ac095ca424f3f17610bf1e8df88 (diff) |
[VVP] onap-client refactoring
removing create hook from _init_ for resources
removing _init_ for non-abstract resources
refactor validation logic
enhancing error catch for resource failure
adding _on_failure hook
Issue-ID: VVP-441
Signed-off-by: stark, steven <steven.stark@att.com>
Change-Id: Ia627fc7fd35fe6e112d6f89399701c70b5888077
Diffstat (limited to 'onap-client/onap_client/tests/test_resource.py')
-rw-r--r-- | onap-client/onap_client/tests/test_resource.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/onap-client/onap_client/tests/test_resource.py b/onap-client/onap_client/tests/test_resource.py index 5b4124a..6f7a014 100644 --- a/onap-client/onap_client/tests/test_resource.py +++ b/onap-client/onap_client/tests/test_resource.py @@ -34,20 +34,16 @@ # limitations under the License. # # ============LICENSE_END============================================ - from onap_client.resource import Resource -from onap_client.lib import generate_dummy_string, generate_dummy_date class TestResource(Resource): - def __init__(self, test_param): - test_input = {} - - test_input["param1"] = test_param - test_input["param2"] = generate_dummy_string() - test_input["param3"] = generate_dummy_date() - - super().__init__(test_input) + spec = { + "param1": { + "type": str, + "required": True, + }, + } def _create(self, create_input): return create_input @@ -62,7 +58,7 @@ class TestResource(Resource): def test_resource(): test_param = "abc" - r = TestResource(test_param) - r.print() + r = TestResource(param1=test_param) + r.create() assert hasattr(r, "param1") and r.param1 == test_param |