Exemplo n.º 1
0
    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")
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
    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)