示例#1
0
 def test_auth_secret_file_is_persistent(self):
     conf = Conf()
     with tempfile.NamedTemporaryFile() as asf:
         conf.auth_secret_file = asf.name
     res1 = module.resolve_auth_secret(conf)
     res2 = module.resolve_auth_secret(conf)
     self.assertEqual(res1, res2)
示例#2
0
    def test_auth_secret_file_is_sufficient(self):
        with tempfile.NamedTemporaryFile() as asf:
            asf.write("baz")
            asf.flush()

            conf = Conf()
            conf.auth_secret_file = asf.name
            res = module.resolve_auth_secret(conf)
            self.assertEqual(res, "baz")
示例#3
0
    def test_auth_secret_wins_over_file(self):
        with tempfile.NamedTemporaryFile() as asf:
            asf.write("baz")
            asf.flush()

            conf = Conf()
            conf.auth_secret = "foobar"
            conf.auth_secret_file = asf.name
            res = module.resolve_auth_secret(conf)
            self.assertEqual(res, "foobar")
示例#4
0
 def test_auth_secret_file_autogenerated(self):
     conf = Conf()
     with tempfile.NamedTemporaryFile() as asf:
         conf.auth_secret_file = asf.name
     res = module.resolve_auth_secret(conf)
     self.assert_(len(res) == 32)
示例#5
0
    def test_auth_secret_is_sufficient(self):
        conf = Conf()
        conf.auth_secret = "foobar"

        res = module.resolve_auth_secret(conf)
        self.assertEqual(res, "foobar")