Пример #1
0
 def test_init_reader_with_str_as_value(self):
     with self.assertRaises(TypeError):
         UrlConfig('http://config.json', reader='non reader')
Пример #2
0
 def test_init_reader_with_reader_value(self):
     reader = JsonReader()
     config = UrlConfig('http://config.json', reader=reader)
     self.assertEqual(reader, config.reader)
Пример #3
0
 def test_get_reader_with_default_value(self):
     config = UrlConfig('http://config.json')
     self.assertIsNone(config.reader)
Пример #4
0
 def test_init_url_with_str_value(self):
     config = UrlConfig('http://config.json')
     self.assertEqual('http://config.json', config.url)
Пример #5
0
 def test_load_real_url(self):
     config = UrlConfig('http://date.jsontest.com/')
     config.load()
     self.assertIsNotNone(config['time'])
Пример #6
0
 def test_init_url_with_int_value(self):
     with self.assertRaises(TypeError):
         UrlConfig(url=123)
Пример #7
0
from central.config.url import UrlConfig

config = UrlConfig('http://date.jsontest.com/')
config.load()

print(config.get('time'))
print(config.get('milliseconds_since_epoch'))
print(config.get('date'))