X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=tests%2Fintegration%2Ftest_clientdriver_fake_stx_sa.py;h=56c92d373f0d9e861459e87b978fad6078c0cba6;hb=defe8209b3628593c186487857fe02586d7e1503;hp=8dc84d9eaf09a5b52542c041de3eeb56dedc4896;hpb=1c5999c04742b704a3b78fe9acecba09d41f0d11;p=pti%2Fo2.git diff --git a/tests/integration/test_clientdriver_fake_stx_sa.py b/tests/integration/test_clientdriver_fake_stx_sa.py index 8dc84d9..56c92d3 100644 --- a/tests/integration/test_clientdriver_fake_stx_sa.py +++ b/tests/integration/test_clientdriver_fake_stx_sa.py @@ -1,59 +1,59 @@ -# Copyright (C) 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. - -from datetime import date, datetime -import sys -import pytest -from o2ims.adapter import ocloud_repository as repository -from o2ims.domain import ocloud -from o2common.config import config -import logging -import uuid -import json -from o2ims.adapter.clients.ocloud_sa_client import StxSaOcloudClient -from o2ims.domain import stx_object as ocloudModel -from o2ims.domain.resource_type import ResourceTypeEnum - -# pytestmark = pytest.mark.usefixtures("mappers") - - -class FakeStxSaClientImp(object): - def __init__(self): - super().__init__() - - def getInstanceInfo(self) -> ocloudModel.StxGenericModel: - model = ocloudModel.StxGenericModel(ResourceTypeEnum.OCLOUD) - model.id = uuid.uuid4() - model.name = "stx1" - model.updatetime = datetime.now - model.createtime = datetime.now - model.content = json.dumps({}) - return model - - -@pytest.fixture -def fake_driver_imp(): - fakedriver = FakeStxSaClientImp() - yield fakedriver - - -def test_get_instanceinfo(fake_driver_imp): - logger = logging.getLogger(__name__) - stxclientimp = StxSaOcloudClient(fake_driver_imp) - assert stxclientimp is not None - systeminfo = stxclientimp.get(None) - assert systeminfo is not None - assert systeminfo.id is not None - assert systeminfo.name == "stx1" - assert systeminfo.content == json.dumps({}) +# Copyright (C) 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. + +from datetime import date, datetime +import sys +import pytest +from o2ims.adapter import ocloud_repository as repository +from o2ims.domain import ocloud +from o2common.config import config +import logging +import uuid +import json +from o2ims.adapter.clients.ocloud_sa_client import StxSaOcloudClient +from o2ims.domain import stx_object as ocloudModel +from o2ims.domain.resource_type import ResourceTypeEnum + +# pytestmark = pytest.mark.usefixtures("mappers") + + +class FakeStxSaClientImp(object): + def __init__(self): + super().__init__() + + def getInstanceInfo(self) -> ocloudModel.StxGenericModel: + model = ocloudModel.StxGenericModel(ResourceTypeEnum.OCLOUD) + model.id = uuid.uuid4() + model.name = "stx1" + model.updatetime = datetime.now + model.createtime = datetime.now + model.content = json.dumps({}) + return model + + +@pytest.fixture +def fake_driver_imp(): + fakedriver = FakeStxSaClientImp() + yield fakedriver + + +def test_get_instanceinfo(fake_driver_imp): + logger = logging.getLogger(__name__) + stxclientimp = StxSaOcloudClient(fake_driver_imp) + assert stxclientimp is not None + systeminfo = stxclientimp.get(None) + assert systeminfo is not None + assert systeminfo.id is not None + assert systeminfo.name == "stx1" + assert systeminfo.content == json.dumps({})