def test_github_notification_with_connection_debug_logs_and_delegates(self): f = self._build_factory() m_addr = self.make_mock() f.buildProtocol(m_addr) # Peek behind the curtain: self.assertIsNotNone(f._protoinstance) m_protoinstance = self.make_mock() # Poke behind the curtain: f._protoinstance = m_protoinstance eventid = 42 eventname = 'blah-event' eventdict = {'fruit': 'apple', 'meat': 'pork'} f.handle_github_notification(eventid, eventname, eventdict) self.assert_calls_equal( self.m_loghandler, [call.handle(ArgIsLogRecord(levelname='DEBUG', msg=self.GithubNotificationLogTmpl))]) self.assert_calls_equal( m_protoinstance, [call.handle_github_notification(eventid, eventname, eventdict)])
def test_github_notification_delegation(self): m_factory = self.make_mock() # Poke behind the curtain: self.client._factory = m_factory eventid = 42 eventname = 'blah-event' eventdict = {'fruit': 'apple', 'meat': 'pork'} self.client.handle_github_notification(eventid, eventname, eventdict) self.assert_calls_equal( m_factory, [call.handle_github_notification(eventid, eventname, eventdict)])