def test_unregister_service(self): address = "ipc:///tmp/nmos-nodefacade.dummy.for.test" srv_type = "dummy_type" UUT = Facade(srv_type, address=address) UUT.srv_registered = True UUT.unregister_service() self.assertIsNotNone(UUT.ipc) UUT.ipc.srv_unregister.assert_called_once_with(srv_type, mock.ANY) self.assertFalse(UUT.srv_registered)
def test_unregister_service_bails_when_no_ipc(self): address = "ipc:///tmp/nmos-nodefacade.dummy.for.test" srv_type = "dummy_type" UUT = Facade(srv_type, address=address) self.mocks['nmosnode.facade.Proxy'].side_effect = Exception UUT.srv_registered = True UUT.unregister_service() self.assertIsNone(UUT.ipc) self.assertTrue(UUT.srv_registered)
def test_unregister_service_bails_when_unregister_raises(self): address = "ipc:///tmp/nmos-nodefacade.dummy.for.test" srv_type = "dummy_type" UUT = Facade(srv_type, address=address) self.mocks[ 'nmosnode.facade.Proxy'].return_value.srv_unregister.side_effect = Exception UUT.srv_registered = True UUT.unregister_service() self.assertIsNone(UUT.ipc) self.mocks[ 'nmosnode.facade.Proxy'].return_value.srv_unregister.assert_called_once_with( srv_type, mock.ANY) self.assertTrue(UUT.srv_registered)