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

Commit 6c92ce3

Browse files
committed
Rename module
1 parent c1a735f commit 6c92ce3

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

tests/test_event.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
"""Tests for EventService."""
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.event import EventService
15+
from pancloud.httpclient import HTTPClient
16+
from pancloud.exceptions import RequiredKwargsError, \
17+
UnexpectedKwargsError
18+
19+
20+
TARPIT = os.environ.get('TARPIT', 'http://10.255.255.1')
21+
22+
23+
class TestLoggingService:
24+
25+
def test_entry_points(self):
26+
27+
EventService(url=TARPIT).session
28+
EventService(url=TARPIT).kwargs
29+
EventService(url=TARPIT).url
30+
EventService(url=TARPIT).get_filters
31+
EventService(url=TARPIT).set_filters
32+
EventService(url=TARPIT).poll
33+
EventService(url=TARPIT).ack
34+
EventService(url=TARPIT).nack
35+
36+
def test_repr(self):
37+
assert repr(
38+
EventService(url='http://', verify=False)
39+
) == "EventService(url='http://', verify=False)"
40+
41+
def test_required_kwargs(self):
42+
with pytest.raises(RequiredKwargsError):
43+
EventService()
44+
45+
with pytest.raises(RequiredKwargsError):
46+
EventService(session=None)
47+
48+
def test_unexpected_kwargs(self):
49+
with pytest.raises(UnexpectedKwargsError):
50+
EventService(url=TARPIT, foo='foo')
51+
52+
def test_session(self):
53+
session = HTTPClient(url=TARPIT)
54+
EventService(session=session)

0 commit comments

Comments
 (0)