Example #1
0
 def test_read(self):
     defaults = (
         '[section]\n'
         'hello=world\n'
     )
     conf = imageproxy.read_config(defaults)
     self.assertEqual(conf.sections(), ['section'])
     self.assertEqual(conf.items('section'), [('hello', 'world')])
Example #2
0
    def test_parse_site(self):
        defaults = (
            '[site:example.com]\n'
            'cache=true\n'
            'prefix=/media\n'
            'root=/dev/null\n'
        )
        conf = imageproxy.read_config(defaults)
        sites, types = imageproxy.parse_config(conf)

        self.assertTrue(isinstance(types, dict))
        self.assertEqual(len(types), 0)

        self.assertEqual(sites.keys(), ['example.com'])
        self.assertEqual(sites['example.com'], {'cache': True,
                                                'prefix': '/media',
                                                'root': '/dev/null'})