blob: c6d301b5cf38c3dc21962a71f531d72e344a5345 [file] [log] [blame]
Gopinath Taget22383d92018-08-22 12:28:52 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# Tests for VEpcServiceInstance model policies
17
18import base64
19import json
20import os
21import sys
22import unittest
23from mock import patch, PropertyMock, ANY, MagicMock
24from unit_test_common import setup_sync_unit_test
25
26
27class TestVEpcServiceInstancePolicy(unittest.TestCase):
28
29 def setUp(self):
30 self.unittest_setup = setup_sync_unit_test(os.path.abspath(os.path.dirname(os.path.realpath(__file__))),
31 globals(),
32 [("vepcservice", "vepcservice.xproto"),
33 ("kubernetes-service", "kubernetes.xproto")] )
34
35 self.MockObjectList = self.unittest_setup["MockObjectList"]
36
37 sys.path.append(os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(__file__))), "../model_policies"))
38
39 from model_policy_vepcserviceinstance import VEpcServiceInstancePolicy
40 self.policy_class = VEpcServiceInstancePolicy
41
42 self.service = VEpcService()
43 self.k8s_service = KubernetesService(id=1111)
44 self.k8s_service.get_service_instance_class=MagicMock(return_value=KubernetesServiceInstance)
45 self.trust_domain = TrustDomain(owner=self.k8s_service, name="test-trust")
46 self.image = Image(name="test-image", tag="1.2", kind="container")
47 self.slice = Slice(trust_domain=self.trust_domain, service=self.service, default_image = self.image)
48 self.service.slices = self.MockObjectList([self.slice])
49
50 def tearDown(self):
51 sys.path = self.unittest_setup["sys_path_save"]
52
53if __name__ == '__main__':
54 unittest.main()