-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.py
32 lines (26 loc) · 872 Bytes
/
test.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
import unittest
from config import get_config
from main import Collector
class TestConfigRelated(unittest.TestCase):
def test_get_config(self):
"""
Check if all goes well when a config file can be found
"""
self.assertIn("log", get_config(filename="sample.ini"))
def test_get_config_multiple_fields(self):
"""
Check if function gets other sectors from ini file
"""
self.assertIn(
"access_token",
get_config(section="GITHUB", filename="sample.ini")
)
def test_get_config_no_file(self):
"""
Check if fails when no config file can be found
"""
with self.assertRaises(FileNotFoundError):
get_config(filename="fail.ini")
class TestCollector(unittest.TestCase):
def setUp(self):
self.collector = Collector()