Skip to content
This repository was archived by the owner on Mar 30, 2026. It is now read-only.

Commit 6f18bf8

Browse files
committed
Rename module
1 parent 6c92ce3 commit 6f18bf8

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

tests/test_logging.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""Tests for LoggingService."""
5+
6+
import os
7+
import sys
8+
9+
import pytest
10+
11+
curpath = os.path.dirname(os.path.abspath(__file__))
12+
sys.path[:0] = [os.path.join(curpath, os.pardir)]
13+
14+
from pancloud.logging import LoggingService
15+
from pancloud.httpclient import HTTPClient
16+
from pancloud.exceptions import RequiredKwargsError, \
17+
UnexpectedKwargsError, HTTPError
18+
19+
20+
HTTPBIN = os.environ.get('HTTPBIN_URL', 'http://httpbin.org')
21+
TARPIT = os.environ.get('TARPIT', 'http://10.255.255.1')
22+
23+
24+
class TestLoggingService:
25+
26+
def test_entry_points(self):
27+
28+
LoggingService(url=TARPIT).session
29+
LoggingService(url=TARPIT).kwargs
30+
LoggingService(url=TARPIT).url
31+
LoggingService(url=TARPIT).poll
32+
LoggingService(url=TARPIT).query
33+
LoggingService(url=TARPIT).delete
34+
LoggingService(url=TARPIT).iter_poll
35+
LoggingService(url=TARPIT).poll_all
36+
LoggingService(url=TARPIT).xpoll
37+
38+
def test_repr(self):
39+
assert repr(
40+
LoggingService(url='http://', verify=False)
41+
) == "LoggingService(url='http://', verify=False)"
42+
43+
def test_required_kwargs(self):
44+
with pytest.raises(RequiredKwargsError):
45+
LoggingService()
46+
47+
with pytest.raises(RequiredKwargsError):
48+
LoggingService(session=None)
49+
50+
def test_unexpected_kwargs(self):
51+
with pytest.raises(UnexpectedKwargsError):
52+
LoggingService(url=TARPIT, foo='foo')
53+
54+
def test_session(self):
55+
session = HTTPClient(url=TARPIT)
56+
LoggingService(session=session)
57+

0 commit comments

Comments
 (0)