def test_send(self, _agent): context = Context() # test Profile.send(context) # validation context.__enter__.assert_called_once_with() self.assertTrue(context.__exit__.called) _agent.assert_called_with(context.url, context.address, secret=context.secret, authenticator=context.authenticator) _agent.return_value.Profile.return_value.send.assert_called_with()
def test_send(self, _agent): context = Context() # test Profile.send(context) # validation context.__enter__.assert_called_once_with() self.assertTrue(context.__exit__.called) _agent.assert_called_with( context.url, context.address, secret=context.secret, authenticator=context.authenticator) _agent.return_value.Profile.return_value.send.assert_called_with()
def test_send(self, mock_gofer_agent): context = Mock() context.route = '123' context.secret = 'test-secret' context.url = 'http://broker.com' context.authenticator = Mock() mock_agent = Mock() mock_gofer_agent.return_value = mock_agent mock_profile = Mock() mock_agent.Profile = Mock(return_value=mock_profile) Profile.send(context) mock_gofer_agent.assert_called_with( context.url, context.route, secret=context.secret, authenticator=context.authenticator) mock_profile.send.assert_called_with()
def test_send(self, mock_gofer_agent): context = Mock() context.agent_id = "123" context.secret = "test-secret" context.url = "http://broker.com" context.transport = "qpid" context.authenticator = Mock() mock_agent = Mock() mock_gofer_agent.return_value = mock_agent mock_profile = Mock() mock_agent.Profile = Mock(return_value=mock_profile) Profile.send(context) mock_gofer_agent.assert_called_with( context.agent_id, url=context.url, transport=context.transport, secret=context.secret, authenticator=context.authenticator, ) mock_profile.send.assert_called_with()