X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FN2VC.git;a=blobdiff_plain;f=tests%2Ftest_model.py;fp=tests%2Ftest_model.py;h=0000000000000000000000000000000000000000;hp=e5d1f78194f8b1626f41d95407a89aa89f4fdca0;hb=b4e7f5c425df48f7e946d792184d1d1b44879fe9;hpb=83e558987289d47f338ecd989ee0997987673f4a diff --git a/tests/test_model.py b/tests/test_model.py deleted file mode 100644 index e5d1f78..0000000 --- a/tests/test_model.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2019 Canonical Ltd. - -# 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. - -""" -Test N2VC's ssh key generation -""" -import n2vc -import pytest -from . import base -import uuid - - -@pytest.mark.asyncio -async def test_model_create(): - """Test the creation of a new model.""" - client = base.get_n2vc() - - model_name = "test-{}".format( - uuid.uuid4().hex[-4:], - ) - - pytest.assume(await client.CreateNetworkService(model_name)) - pytest.assume(await client.DestroyNetworkService(model_name)) - pytest.assume(await client.logout()) - - -@pytest.mark.asyncio -async def test_destroy_non_existing_network_service(): - """Destroy a model that doesn't exist.""" - - client = base.get_n2vc() - - model_name = "test-{}".format( - uuid.uuid4().hex[-4:], - ) - - with pytest.raises(n2vc.vnf.NetworkServiceDoesNotExist): - pytest.assume(await client.DestroyNetworkService(model_name)) - - pytest.assume(await client.logout()) - - -@pytest.mark.asyncio -async def test_model_create_duplicate(): - """Create a new model, and try to create the same model.""" - client = base.get_n2vc() - - model_name = "test-{}".format( - uuid.uuid4().hex[-4:], - ) - - # Try to recreate bug 628 - for x in range(0, 1000): - model = await client.get_model(model_name) - pytest.assume(model) - - pytest.assume(await client.DestroyNetworkService(model_name)) - pytest.assume(await client.logout())