def setUp(self): _, self.htpasswd_ascii_path = tempfile.mkstemp() f = open(self.htpasswd_ascii_path, "w") f.write(HTPASSWD_ASCII) f.close() _, self.htpasswd_utf8_path = tempfile.mkstemp() f = codecs.open(self.htpasswd_utf8_path, "w", "utf-8") f.write(HTPASSWD_UTF8) f.close() self.users = read_htpasswd(self.htpasswd_ascii_path) self.users_utf8 = read_htpasswd(self.htpasswd_utf8_path)
def test_parse_htpasswd(self): users = read_htpasswd(self.htpasswd_ascii_path) assert len(users) == 3 assert "md5" in users assert "sha" in users assert "crypt" in users