New event handling imported from att-workflow-driver
Change-Id: I692e4eb7604a42d47416474fac1c45dbf0ccfbe1
diff --git a/xos/synchronizer/event_steps/test_dhcp_event.py b/xos/synchronizer/event_steps/test_dhcp_event.py
index d7934da..d51ee7a 100644
--- a/xos/synchronizer/event_steps/test_dhcp_event.py
+++ b/xos/synchronizer/event_steps/test_dhcp_event.py
@@ -13,12 +13,14 @@
# limitations under the License.
import unittest
-from mock import patch, call, Mock, PropertyMock
+from mock import patch, Mock
import json
-import os, sys
+import os
+import sys
-test_path=os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
+test_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
+
class TestSubscriberAuthEvent(unittest.TestCase):
@@ -42,7 +44,7 @@
import xossynchronizer.modelaccessor
import mock_modelaccessor
- reload(mock_modelaccessor) # in case nose2 loaded it in a previous test
+ reload(mock_modelaccessor) # in case nose2 loaded it in a previous test
reload(xossynchronizer.modelaccessor) # in case nose2 loaded it in a previous test
from xossynchronizer.modelaccessor import model_accessor
@@ -74,28 +76,22 @@
self.si.serial_number = "BRCM1234"
self.si.save = Mock()
-
def tearDown(self):
sys.path = self.sys_path_save
def test_dhcp_subscriber(self):
self.event.value = json.dumps({
- "deviceId" : "of:0000000000000001",
- "portNumber" : "1",
- "macAddress" : self.mac_address,
- "ipAddress" : self.ip_address,
- "messageType": "DHCPREQUEST"
+ "deviceId": "of:0000000000000001",
+ "portNumber": "1",
+ "macAddress": self.mac_address,
+ "ipAddress": self.ip_address,
+ "messageType": "DHCPREQUEST",
+ 'serialNumber': "BRCM1234",
})
- with patch.object(VOLTService.objects, "get_items") as volt_service_mock, \
- patch.object(TtWorkflowDriverServiceInstance.objects, "get_items") as si_mock, \
- patch.object(self.volt, "get_onu_sn_from_openflow") as get_onu_sn:
+ with patch.object(TtWorkflowDriverServiceInstance.objects, "get_items") as si_mock:
- self.assertTrue(VOLTService.objects.first() is not None)
-
- volt_service_mock.return_value = [self.volt]
- get_onu_sn.return_value = "BRCM1234"
si_mock.return_value = [self.si]
self.event_step.process_event(self.event)
@@ -105,6 +101,7 @@
self.assertEqual(self.si.mac_address, self.mac_address)
self.assertEqual(self.si.ip_address, self.ip_address)
+
if __name__ == '__main__':
- sys.path.append("..") # for import of helpers.py
- unittest.main()
\ No newline at end of file
+ sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")) # for import of helpers.py
+ unittest.main()