Wei-Yu Chen | 49950b9 | 2021-11-08 19:19:18 +0800 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2020 The Magma Authors. |
| 3 | |
| 4 | This source code is licensed under the BSD-style license found in the |
| 5 | LICENSE file in the root directory of this source tree. |
| 6 | |
| 7 | Unless required by applicable law or agreed to in writing, software |
| 8 | distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | See the License for the specific language governing permissions and |
| 11 | limitations under the License. |
| 12 | """ |
| 13 | |
| 14 | from unittest import TestCase, mock |
| 15 | |
| 16 | import magma.enodebd.tests.test_utils.mock_functions as enb_mock |
| 17 | |
| 18 | |
| 19 | class EnodebHandlerTestCase(TestCase): |
| 20 | """ |
| 21 | Sets up test class with a set of patches needed for eNodeB handlers |
| 22 | """ |
| 23 | |
| 24 | def setUp(self): |
| 25 | self.patches = { |
| 26 | enb_mock.GET_IP_FROM_IF_PATH: |
| 27 | mock.Mock(side_effect=enb_mock.mock_get_ip_from_if), |
| 28 | enb_mock.LOAD_SERVICE_MCONFIG_PATH: |
| 29 | mock.Mock( |
| 30 | side_effect=enb_mock.mock_load_service_mconfig_as_json, |
| 31 | ), |
| 32 | } |
| 33 | self.applied_patches = [ |
| 34 | mock.patch(patch, data) for patch, data in |
| 35 | self.patches.items() |
| 36 | ] |
| 37 | for patch in self.applied_patches: |
| 38 | patch.start() |
| 39 | self.addCleanup(mock.patch.stopall) |