diff options
author | 2019-12-11 12:00:26 +0000 | |
---|---|---|
committer | 2020-01-20 12:54:46 +0000 | |
commit | bbe05d8a65ee0ac698d906b50282406bafe34f80 (patch) | |
tree | d2698f139427f9741eb8712682ffb73940a81d6e /components/pm-subscription-handler/tests/test_subscription.py | |
parent | 85888c96619588108b7c97000ece0c13b27ac015 (diff) |
Adding AAI client and apply filter
# Adding Subscription class
# Adding MR and Utils helper classes
Signed-off-by: efiacor <fiachra.corcoran@est.tech>
Change-Id: I791b506d8cf166737d67cef22052852256f8a811
Issue-ID: DCAEGEN2-1930
Diffstat (limited to 'components/pm-subscription-handler/tests/test_subscription.py')
-rw-r--r-- | components/pm-subscription-handler/tests/test_subscription.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/components/pm-subscription-handler/tests/test_subscription.py b/components/pm-subscription-handler/tests/test_subscription.py new file mode 100644 index 00000000..cbf930fd --- /dev/null +++ b/components/pm-subscription-handler/tests/test_subscription.py @@ -0,0 +1,43 @@ +# ============LICENSE_START=================================================== +# Copyright (C) 2019 Nordix Foundation. +# ============================================================================ +# 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. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END===================================================== +import json +import os +import unittest + +from mod.subscription import Subscription, XnfFilter + + +class SubscriptionTestCase(unittest.TestCase): + + def setUp(self): + with open(os.path.join(os.path.dirname(__file__), 'data/cbs_data.json'), 'r') as data: + self.cbs_data = json.load(data) + self.sub = Subscription(**self.cbs_data['policy']['subscription']) + self.xnf_filter = XnfFilter(**self.sub.nfFilter) + + def test_xnf_filter_true(self): + self.assertTrue(self.xnf_filter.is_xnf_in_filter('pnf1')) + + def test_xnf_filter_false(self): + self.assertFalse(self.xnf_filter.is_xnf_in_filter('PNF-33')) + + def test_sub_measurement_group(self): + self.assertEqual(len(self.sub.measurementGroups), 2) + + def test_sub_file_location(self): + self.assertEqual(self.sub.fileLocation, '/pm/pm.xml') |