Exemplo n.º 1
0
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_whitelist=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 testWhitelistDomains(self):
        expected = {"a.com": ("c", "d"), "boring.com": ("e",)}
        self.assertEqual(expected, self.cfg.getDomainWhitelist())
Exemplo n.º 2
0
    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_whitelist=a.com:c|d, boring.com:e
""")
        self.cfg = AUSConfig(self.config_file)
Exemplo n.º 3
0
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_whitelist=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 testWhitelistDomains(self):
        expected = {'a.com': ('c', 'd'), 'boring.com': ('e',)}
        self.assertEquals(expected, self.cfg.getDomainWhitelist())
Exemplo n.º 4
0
    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_whitelist=a.com:c|d, boring.com:e
""")
        self.cfg = AUSConfig(self.config_file)