Wei-Yu Chen | ad55cb8 | 2022-02-15 20:07:01 +0800 | [diff] [blame^] | 1 | # SPDX-FileCopyrightText: 2020 The Magma Authors. |
| 2 | # SPDX-FileCopyrightText: 2022 Open Networking Foundation <support@opennetworking.org> |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
Wei-Yu Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 5 | |
| 6 | from unittest import TestCase, mock |
| 7 | |
| 8 | import magma.enodebd.tests.test_utils.mock_functions as enb_mock |
| 9 | |
| 10 | |
| 11 | class EnodebHandlerTestCase(TestCase): |
| 12 | """ |
| 13 | Sets up test class with a set of patches needed for eNodeB handlers |
| 14 | """ |
| 15 | |
| 16 | def setUp(self): |
| 17 | self.patches = { |
| 18 | enb_mock.GET_IP_FROM_IF_PATH: |
| 19 | mock.Mock(side_effect=enb_mock.mock_get_ip_from_if), |
| 20 | enb_mock.LOAD_SERVICE_MCONFIG_PATH: |
| 21 | mock.Mock( |
| 22 | side_effect=enb_mock.mock_load_service_mconfig_as_json, |
| 23 | ), |
| 24 | } |
| 25 | self.applied_patches = [ |
| 26 | mock.patch(patch, data) for patch, data in |
| 27 | self.patches.items() |
| 28 | ] |
| 29 | for patch in self.applied_patches: |
| 30 | patch.start() |
| 31 | self.addCleanup(mock.patch.stopall) |