1 # Copyright (c) 2019 Viosoft Corporation
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 from yardstick.network_services.traffic_profile import sip
21 class TestSipProfile(unittest.TestCase):
24 "schema": "nsb:traffic_profile:0.1",
26 "description": "Traffic profile to run sip",
28 "traffic_type": "SipProfile",
29 "frame_rate": 100, # pps
31 "enable_latency": False}}
34 self.sip_profile = sip.SipProfile(self.TRAFFIC_PROFILE)
36 def test___init__(self):
37 self.assertIsNone(self.sip_profile.generator)
39 def test_execute_traffic(self):
40 self.sip_profile.generator = None
41 mock_traffic_generator = mock.Mock()
42 self.sip_profile.execute_traffic(mock_traffic_generator)
43 self.assertIsNotNone(self.sip_profile.generator)
45 def test_is_ended_true(self):
46 self.sip_profile.generator = mock.Mock(return_value=True)
47 self.assertTrue(self.sip_profile.is_ended())
49 def test_is_ended_false(self):
50 self.sip_profile.generator = None
51 self.assertFalse(self.sip_profile.is_ended())