Beispiel #1
0
 def test_init_reader_with_str_as_value(self):
     with self.assertRaises(TypeError):
         UrlConfig('http://config.json', reader='non reader')
Beispiel #2
0
 def test_init_reader_with_reader_value(self):
     reader = JsonReader()
     config = UrlConfig('http://config.json', reader=reader)
     self.assertEqual(reader, config.reader)
Beispiel #3
0
 def test_get_reader_with_default_value(self):
     config = UrlConfig('http://config.json')
     self.assertIsNone(config.reader)
Beispiel #4
0
 def test_init_url_with_str_value(self):
     config = UrlConfig('http://config.json')
     self.assertEqual('http://config.json', config.url)
Beispiel #5
0
 def test_load_real_url(self):
     config = UrlConfig('http://date.jsontest.com/')
     config.load()
     self.assertIsNotNone(config['time'])
Beispiel #6
0
 def test_init_url_with_int_value(self):
     with self.assertRaises(TypeError):
         UrlConfig(url=123)
Beispiel #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'))