Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 1 | |
| 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 | |
| 17 | import unittest |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 18 | from mock import patch |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 19 | |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 20 | import os |
| 21 | import sys |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 22 | |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 23 | test_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 24 | |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 25 | |
| 26 | class TestModelPolicyAttWorkflowDriverServiceInstance(unittest.TestCase): |
| 27 | def setUp(self): |
| 28 | |
| 29 | self.sys_path_save = sys.path |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 30 | |
| 31 | config = os.path.join(test_path, "../test_config.yaml") |
| 32 | from xosconfig import Config |
| 33 | Config.clear() |
| 34 | Config.init(config, 'synchronizer-config-schema.yaml') |
| 35 | |
Scott Baker | 71d2047 | 2019-02-01 12:05:35 -0800 | [diff] [blame] | 36 | from xossynchronizer.mock_modelaccessor_build import mock_modelaccessor_config |
| 37 | mock_modelaccessor_config(test_path, [("att-workflow-driver", "att-workflow-driver.xproto"), |
| 38 | ("olt-service", "volt.xproto"), |
Matteo Scandolo | ad6c894 | 2019-02-14 13:02:08 -0800 | [diff] [blame] | 39 | ("rcord", "rcord.xproto")]) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 40 | |
Scott Baker | 71d2047 | 2019-02-01 12:05:35 -0800 | [diff] [blame] | 41 | import xossynchronizer.modelaccessor |
| 42 | import mock_modelaccessor |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 43 | reload(mock_modelaccessor) # in case nose2 loaded it in a previous test |
Scott Baker | 71d2047 | 2019-02-01 12:05:35 -0800 | [diff] [blame] | 44 | reload(xossynchronizer.modelaccessor) # in case nose2 loaded it in a previous test |
| 45 | |
| 46 | from xossynchronizer.modelaccessor import model_accessor |
| 47 | from model_policy_att_workflow_driver_serviceinstance import AttWorkflowDriverServiceInstancePolicy, AttHelpers |
| 48 | self.AttHelpers = AttHelpers |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 49 | |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 50 | # import all class names to globals |
| 51 | for (k, v) in model_accessor.all_model_classes.items(): |
| 52 | globals()[k] = v |
| 53 | |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 54 | # Some of the functions we call have side-effects. For example, creating a VSGServiceInstance may lead to |
| 55 | # creation of tags. Ideally, this wouldn't happen, but it does. So make sure we reset the world. |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 56 | model_accessor.reset_all_object_stores() |
| 57 | |
Scott Baker | 71d2047 | 2019-02-01 12:05:35 -0800 | [diff] [blame] | 58 | self.policy = AttWorkflowDriverServiceInstancePolicy(model_accessor=model_accessor) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 59 | self.si = AttWorkflowDriverServiceInstance() |
| 60 | self.si.owner = AttWorkflowDriverService() |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 61 | self.si.serial_number = "BRCM1234" |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 62 | |
| 63 | def tearDown(self): |
| 64 | sys.path = self.sys_path_save |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 65 | |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 66 | def test_update_onu(self): |
| 67 | |
| 68 | onu = ONUDevice( |
| 69 | serial_number="BRCM1234", |
| 70 | admin_state="ENABLED" |
| 71 | ) |
| 72 | with patch.object(ONUDevice.objects, "get_items") as get_onu, \ |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 73 | patch.object(onu, "save") as onu_save: |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 74 | get_onu.return_value = [onu] |
| 75 | |
| 76 | self.policy.update_onu("brcm1234", "ENABLED") |
| 77 | onu_save.assert_not_called() |
| 78 | |
| 79 | self.policy.update_onu("brcm1234", "DISABLED") |
| 80 | self.assertEqual(onu.admin_state, "DISABLED") |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 81 | onu_save.assert_called_with( |
| 82 | always_update_timestamp=True, update_fields=[ |
| 83 | 'admin_state', 'serial_number', 'updated']) |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 84 | |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 85 | def test_enable_onu(self): |
Scott Baker | 71d2047 | 2019-02-01 12:05:35 -0800 | [diff] [blame] | 86 | with patch.object(self.AttHelpers, "validate_onu") as validate_onu, \ |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 87 | patch.object(self.policy, "update_onu") as update_onu: |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 88 | validate_onu.return_value = [True, "valid onu"] |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 89 | |
Andy Bavier | afaf176 | 2019-01-16 09:41:43 -0700 | [diff] [blame] | 90 | self.policy.process_onu_state(self.si) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 91 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 92 | update_onu.assert_called_once() |
| 93 | update_onu.assert_called_with("BRCM1234", "ENABLED") |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 94 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 95 | self.assertIn("valid onu", self.si.status_message) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 96 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 97 | def test_disable_onu(self): |
Scott Baker | 71d2047 | 2019-02-01 12:05:35 -0800 | [diff] [blame] | 98 | with patch.object(self.AttHelpers, "validate_onu") as validate_onu, \ |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 99 | patch.object(self.policy, "update_onu") as update_onu: |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 100 | validate_onu.return_value = [False, "invalid onu"] |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 101 | |
Andy Bavier | afaf176 | 2019-01-16 09:41:43 -0700 | [diff] [blame] | 102 | self.policy.process_onu_state(self.si) |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 103 | |
| 104 | update_onu.assert_called_once() |
| 105 | update_onu.assert_called_with("BRCM1234", "DISABLED") |
| 106 | |
| 107 | self.assertIn("invalid onu", self.si.status_message) |
| 108 | |
| 109 | def test_handle_update_validate_onu(self): |
| 110 | """ |
| 111 | Testing that handle_update calls validate_onu with the correct parameters |
| 112 | when necessary |
| 113 | """ |
Andy Bavier | afaf176 | 2019-01-16 09:41:43 -0700 | [diff] [blame] | 114 | with patch.object(self.policy, "process_onu_state") as process_onu_state, \ |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 115 | patch.object(self.policy, "update_onu") as update_onu, \ |
| 116 | patch.object(self.policy, "get_subscriber") as get_subscriber: |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 117 | update_onu.return_value = None |
| 118 | get_subscriber.return_value = None |
| 119 | |
| 120 | self.si.onu_state = "AWAITING" |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 121 | self.policy.handle_update(self.si) |
Andy Bavier | afaf176 | 2019-01-16 09:41:43 -0700 | [diff] [blame] | 122 | process_onu_state.assert_called_with(self.si) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 123 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 124 | self.si.onu_state = "ENABLED" |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 125 | self.policy.handle_update(self.si) |
Andy Bavier | afaf176 | 2019-01-16 09:41:43 -0700 | [diff] [blame] | 126 | process_onu_state.assert_called_with(self.si) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 127 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 128 | self.si.onu_state = "DISABLED" |
| 129 | self.policy.handle_update(self.si) |
Andy Bavier | afaf176 | 2019-01-16 09:41:43 -0700 | [diff] [blame] | 130 | process_onu_state.assert_called_with(self.si) |
| 131 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 132 | def test_get_subscriber(self): |
| 133 | |
| 134 | sub = RCORDSubscriber( |
| 135 | onu_device="BRCM1234" |
| 136 | ) |
| 137 | |
| 138 | with patch.object(RCORDSubscriber.objects, "get_items") as get_subscribers: |
| 139 | get_subscribers.return_value = [sub] |
| 140 | |
| 141 | res = self.policy.get_subscriber("BRCM1234") |
| 142 | self.assertEqual(res, sub) |
| 143 | |
| 144 | res = self.policy.get_subscriber("brcm1234") |
| 145 | self.assertEqual(res, sub) |
| 146 | |
| 147 | res = self.policy.get_subscriber("foo") |
| 148 | self.assertEqual(res, None) |
| 149 | |
| 150 | def test_update_subscriber(self): |
| 151 | |
| 152 | sub = RCORDSubscriber( |
| 153 | onu_device="BRCM1234" |
| 154 | ) |
| 155 | |
| 156 | self.si.status_message = "some content" |
| 157 | |
| 158 | with patch.object(sub, "save") as sub_save: |
| 159 | self.si.authentication_state = "AWAITING" |
| 160 | self.policy.update_subscriber(sub, self.si) |
| 161 | self.assertEqual(sub.status, "awaiting-auth") |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 162 | sub_save.assert_called() |
| 163 | sub_save.reset_mock() |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 164 | sub.status = None |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 165 | |
| 166 | self.si.authentication_state = "REQUESTED" |
| 167 | self.policy.update_subscriber(sub, self.si) |
| 168 | self.assertEqual(sub.status, "awaiting-auth") |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 169 | sub_save.assert_called() |
| 170 | sub_save.reset_mock() |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 171 | sub.status = None |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 172 | |
| 173 | self.si.authentication_state = "STARTED" |
| 174 | self.policy.update_subscriber(sub, self.si) |
| 175 | self.assertEqual(sub.status, "awaiting-auth") |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 176 | sub_save.assert_called() |
| 177 | sub_save.reset_mock() |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 178 | sub.status = None |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 179 | |
| 180 | self.si.authentication_state = "APPROVED" |
| 181 | self.policy.update_subscriber(sub, self.si) |
| 182 | self.assertEqual(sub.status, "enabled") |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 183 | sub_save.assert_called() |
| 184 | sub_save.reset_mock() |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 185 | sub.status = None |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 186 | |
| 187 | self.si.authentication_state = "DENIED" |
| 188 | self.policy.update_subscriber(sub, self.si) |
| 189 | self.assertEqual(sub.status, "auth-failed") |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 190 | sub_save.assert_called() |
| 191 | sub_save.reset_mock() |
Matteo Scandolo | c6ac74a | 2018-09-14 08:14:51 -0700 | [diff] [blame] | 192 | sub.status = None |
| 193 | |
| 194 | def test_update_subscriber_not(self): |
| 195 | sub = RCORDSubscriber( |
| 196 | onu_device="BRCM1234" |
| 197 | ) |
| 198 | |
| 199 | with patch.object(sub, "save") as sub_save: |
| 200 | sub.status = "awaiting-auth" |
| 201 | self.si.authentication_state = "AWAITING" |
| 202 | self.policy.update_subscriber(sub, self.si) |
| 203 | sub_save.assert_not_called() |
| 204 | |
| 205 | sub.status = "awaiting-auth" |
| 206 | self.si.authentication_state = "REQUESTED" |
| 207 | self.policy.update_subscriber(sub, self.si) |
| 208 | sub_save.assert_not_called() |
| 209 | |
| 210 | sub.status = "awaiting-auth" |
| 211 | self.si.authentication_state = "STARTED" |
| 212 | self.policy.update_subscriber(sub, self.si) |
| 213 | sub_save.assert_not_called() |
| 214 | |
| 215 | sub.status = "enabled" |
| 216 | self.si.authentication_state = "APPROVED" |
| 217 | self.policy.update_subscriber(sub, self.si) |
| 218 | sub_save.assert_not_called() |
| 219 | |
| 220 | sub.status = "auth-failed" |
| 221 | self.si.authentication_state = "DENIED" |
| 222 | self.policy.update_subscriber(sub, self.si) |
| 223 | sub_save.assert_not_called() |
| 224 | |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 225 | def test_update_subscriber_dhcp_with_exiting_ip(self): |
Matteo Scandolo | de8cfa8 | 2018-10-16 13:49:05 -0700 | [diff] [blame] | 226 | sub = RCORDSubscriber( |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 227 | id=10, |
| 228 | onu_device="BRCM1234" |
| 229 | ) |
| 230 | |
| 231 | ip = RCORDIpAddress( |
| 232 | subscriber_id=sub.id, |
| 233 | ip='10.11.2.23' |
| 234 | ) |
| 235 | |
Andy Bavier | 8ed30c9 | 2018-12-11 13:46:25 -0700 | [diff] [blame] | 236 | self.si.authentication_state = "APPROVED" |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 237 | self.si.dhcp_state = "DHCPACK" |
| 238 | self.si.ip_address = "10.11.2.23" |
| 239 | self.si.mac_address = "4321" |
| 240 | |
| 241 | with patch.object(sub, "save") as sub_save, \ |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 242 | patch.object(RCORDIpAddress.objects, "get_items") as get_ips, \ |
| 243 | patch.object(ip, "save_changed_fields") as ip_mock: |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 244 | |
| 245 | get_ips.return_value = [ip] |
| 246 | ip_mock.return_value = [] |
| 247 | |
| 248 | self.policy.update_subscriber(sub, self.si) |
| 249 | sub_save.assert_called() |
| 250 | self.assertEqual(sub.mac_address, self.si.mac_address) |
| 251 | |
| 252 | ip_mock.assert_called_with() |
| 253 | |
| 254 | def test_update_subscriber_dhcp_with_new_ip(self): |
| 255 | sub = RCORDSubscriber( |
| 256 | id=10, |
Matteo Scandolo | de8cfa8 | 2018-10-16 13:49:05 -0700 | [diff] [blame] | 257 | onu_device="BRCM1234" |
| 258 | ) |
| 259 | |
Andy Bavier | 8ed30c9 | 2018-12-11 13:46:25 -0700 | [diff] [blame] | 260 | self.si.authentication_state = "APPROVED" |
Matteo Scandolo | de8cfa8 | 2018-10-16 13:49:05 -0700 | [diff] [blame] | 261 | self.si.dhcp_state = "DHCPACK" |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 262 | self.si.ip_address = "10.11.2.23" |
Matteo Scandolo | de8cfa8 | 2018-10-16 13:49:05 -0700 | [diff] [blame] | 263 | self.si.mac_address = "4321" |
| 264 | |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 265 | with patch.object(sub, "save") as sub_save, \ |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 266 | patch.object(RCORDIpAddress, "save", autospec=True) as ip_mock: |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 267 | |
| 268 | ip_mock.return_value = [] |
| 269 | |
Matteo Scandolo | de8cfa8 | 2018-10-16 13:49:05 -0700 | [diff] [blame] | 270 | self.policy.update_subscriber(sub, self.si) |
| 271 | sub_save.assert_called() |
| 272 | self.assertEqual(sub.mac_address, self.si.mac_address) |
Matteo Scandolo | de8cfa8 | 2018-10-16 13:49:05 -0700 | [diff] [blame] | 273 | |
Matteo Scandolo | 74f6330 | 2018-11-01 14:05:01 -0700 | [diff] [blame] | 274 | saved_ip = ip_mock.call_args[0][0] |
| 275 | self.assertEqual(saved_ip.ip, self.si.ip_address) |
| 276 | self.assertEqual(saved_ip.subscriber_id, sub.id) |
| 277 | self.assertEqual(saved_ip.description, "DHCP Assigned IP Address") |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 278 | |
| 279 | def test_handle_update_subscriber(self): |
Matteo Scandolo | e8c33d6 | 2018-08-16 14:37:24 -0700 | [diff] [blame] | 280 | self.si.onu_state = "DISABLED" |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 281 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 282 | sub = RCORDSubscriber( |
| 283 | onu_device="BRCM1234" |
Matteo Scandolo | e8c33d6 | 2018-08-16 14:37:24 -0700 | [diff] [blame] | 284 | ) |
| 285 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 286 | with patch.object(self.policy, "get_subscriber") as get_subscriber, \ |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 287 | patch.object(self.policy, "update_onu") as update_onu, \ |
| 288 | patch.object(self.policy, "update_subscriber") as update_subscriber: |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 289 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 290 | get_subscriber.return_value = None |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 291 | self.policy.handle_update(self.si) |
Scott Baker | c2a633d | 2019-04-01 19:27:41 -0700 | [diff] [blame^] | 292 | update_onu.assert_called_with(sub.onu_device, "DISABLED") |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 293 | self.assertEqual(update_subscriber.call_count, 0) |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 294 | |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 295 | get_subscriber.return_value = sub |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 296 | self.policy.handle_update(self.si) |
Matteo Scandolo | ea52909 | 2018-09-11 16:36:39 -0700 | [diff] [blame] | 297 | update_subscriber.assert_called_with(sub, self.si) |
| 298 | |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 299 | |
Matteo Scandolo | ad0c175 | 2018-08-09 15:47:16 -0700 | [diff] [blame] | 300 | if __name__ == '__main__': |
| 301 | unittest.main() |