-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathtest__logger.py
48 lines (37 loc) · 1.5 KB
/
test__logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from tools import Logger, LogType
class TestLocalLogger:
"""Test class for local logger."""
def setup_method(self) -> None:
"""Set up logger."""
self.logger = Logger(name=__name__, log_type=LogType.LOCAL)
def test_log(self) -> None:
"""Test log method of logger."""
assert self.logger.debug("debug") is None
assert self.logger.info("info") is None
assert self.logger.warning("warning") is None
assert self.logger.error("error") is None
assert self.logger.critical("critical") is None
def test_name(self) -> None:
"""Test correct name of logger."""
assert self.logger.name == __name__
class TestGoogleCloudLogger:
"""Test class for Google Cloud logger."""
def setup_method(self) -> None:
"""Set up logger."""
from google.auth.credentials import AnonymousCredentials
self.logger = Logger(
name=__name__,
project=__name__,
credentials=AnonymousCredentials(),
log_type=LogType.GOOGLE_CLOUD,
)
def test_log(self) -> None:
"""Test log method of logger."""
assert self.logger.debug("debug") is None
assert self.logger.info("info") is None
assert self.logger.warning("warning") is None
assert self.logger.error("error") is None
assert self.logger.critical("critical") is None
def test_name(self) -> None:
"""Test correct name of logger."""
assert self.logger.name == __name__