blob: ef2b11fe0d7bd8b7a65029158223cfb81c4939bd [file] [log] [blame]
Wei-Yu Chen49950b92021-11-08 19:19:18 +08001"""
2Copyright 2020 The Magma Authors.
3
4This source code is licensed under the BSD-style license found in the
5LICENSE file in the root directory of this source tree.
6
7Unless required by applicable law or agreed to in writing, software
8distributed under the License is distributed on an "AS IS" BASIS,
9WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10See the License for the specific language governing permissions and
11limitations under the License.
12"""
13
14from unittest import TestCase, mock
15
16import magma.enodebd.tests.test_utils.mock_functions as enb_mock
17
18
19class 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)