Example #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")
Example #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)
Example #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)
Example #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)
Example #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)
Example #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')
Example #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)
Example #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)
Example #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)
Example #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)