def test_connect_fail(self, mock_connection): mock_connection.side_effect = UnauthorizedError() with assert_raises(UnauthorizedError): _connect("My token", "My host") mock_connection.assert_called_once_with("My host", "My token")
def test_connect(self, mock_connection): mock_connection.return_value = mock.create_autospec(Connection) c = _connect("My token", "My host") mock_connection.assert_called_once_with("My host", "My token") assert_true(c)
def test_connect_default_host(self, mock_connection): mock_connection.return_value = mock.create_autospec(Connection) c = _connect("My token") mock_connection.assert_called_once_with(settings.HOST, "My token") assert_true(c)
def test_connect(self, mock_connection): mock_connection.return_value = mock.create_autospec(Connection) c = _connect(self.host, self.token) mock_connection.assert_called_once_with(self.host, self.token) assert_true(c)
def test_connect_fail(self, mock_connection): mock_connection.side_effect = UnauthorizedError() with assert_raises(UnauthorizedError): _connect(self.host, self.token) mock_connection.assert_called_once_with(self.host, self.token)
def test_connect_fail(self, mock_connection): mock_connection.side_effect = UnauthorizedError() with assert_raises(UnauthorizedError): _connect('My token', 'My host') mock_connection.assert_called_once_with('My host', 'My token')
def test_connect_default_host(self, mock_connection): mock_connection.return_value = mock.create_autospec(Connection) c = _connect('My token') mock_connection.assert_called_once_with(settings.HOST, 'My token') assert_true(c)
def test_connect(self, mock_connection): mock_connection.return_value = mock.create_autospec(Connection) c = _connect('My token', 'My host') mock_connection.assert_called_once_with('My host', 'My token') assert_true(c)