forked from sopel-irc/sopel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_config.py
36 lines (27 loc) · 949 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
35
36
# coding=utf-8
from __future__ import unicode_literals, division, print_function, absolute_import
import os
import tempfile
import unittest
from sopel import config
from sopel.config import types
class FakeConfigSection(types.StaticSection):
attr = types.ValidatedAttribute('attr')
class ConfigFunctionalTest(unittest.TestCase):
def read_config(self):
configo = config.Config(self.filename)
configo.define_section('fake', FakeConfigSection)
return configo
def setUp(self):
self.filename = tempfile.mkstemp()[1]
with open(self.filename, 'w') as fileo:
fileo.write(
"[core]\n"
"owner=embolalia"
)
self.config = self.read_config()
def tearDown(self):
os.remove(self.filename)
def test_validated_string_when_none(self):
self.config.fake.attr = None
self.assertEquals(self.config.fake.attr, None)