forked from mozilla-releng/balrog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_config.py
34 lines (27 loc) · 873 Bytes
/
test_config.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
import os
import unittest
from tempfile import mkstemp
from auslib.config import AUSConfig
class TestAUSConfig(unittest.TestCase):
def setUp(self):
self.config_fd, self.config_file = mkstemp()
with open(self.config_file, "w+") as f:
f.write(
"""
[database]
;Database to be used by AUS applications, in URI format
dburi=sqlite:///:memory:
[logging]
;Where to put the application log. No rotation is done on this file.
logfile=/foo/bar/baz
[site-specific]
domain_allowlist=a.com:c|d, boring.com:e
"""
)
self.cfg = AUSConfig(self.config_file)
def tearDown(self):
os.close(self.config_fd)
os.remove(self.config_file)
def testAllowlistDomains(self):
expected = {"a.com": ("c", "d"), "boring.com": ("e",)}
self.assertEqual(expected, self.cfg.getDomainAllowlist())