Files
firefox_decrypt-mirror/tests/direct_profile.t
2025-11-12 21:22:18 +01:00

83 lines
2.8 KiB
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import unittest
from simpletap.fdecrypt import lib
class TestDirectProfilePass(unittest.TestCase):
def validate_one(self, userkey, grepkey, output):
expected = lib.get_user_data(userkey)
matches = lib.grep(grepkey, output, context=1)
self.assertEqual(matches, expected)
def validate(self, out):
self.validate_one("doesntexist", "doesntexist", out)
self.validate_one("onemore", "onemore", out)
self.validate_one("complex", "cömplex", out)
self.validate_one("jamie", "jãmïe", out)
def run_firefox_with_password(self):
cmd = lib.get_script() + [self.test]
pwd = lib.get_password()
output = lib.run(cmd, stdin=pwd)
self.validate(output)
def run_firefox_nopassword(self):
# Must run in non-interactive mode or password prompt will be shown
cmd = lib.get_script() + [self.test, "-n"]
output = lib.run(cmd)
self.validate(output)
@unittest.skipIf(lib.platform == "Windows",
"Windows DLL isn't backwards compatible")
def test_firefox_20(self):
self.test = os.path.join(lib.get_test_data(),
"test_profile_firefox_20")
self.run_firefox_with_password()
@unittest.skipIf(lib.platform == "Windows",
"Windows DLL isn't backwards compatible")
def test_firefox_46(self):
self.test = os.path.join(lib.get_test_data(),
"test_profile_firefox_46")
self.run_firefox_with_password()
def test_firefox_59(self):
self.test = os.path.join(lib.get_test_data(),
"test_profile_firefox_59")
self.run_firefox_with_password()
def test_firefox_144(self):
self.test = os.path.join(lib.get_test_data(),
"test_profile_firefox_144")
self.run_firefox_with_password()
def test_firefox_non_ascii(self):
self.test = os.path.join(lib.get_test_data(),
"test_profile_firefox_LЮшр/")
self.run_firefox_with_password()
@unittest.skipIf(lib.platform == "Windows",
"Windows DLL isn't backwards compatible")
def test_firefox_nopass_46(self):
self.test = os.path.join(lib.get_test_data(),
"test_profile_firefox_nopassword_46")
self.run_firefox_nopassword()
def test_firefox_nopass_59(self):
self.test = os.path.join(lib.get_test_data(),
"test_profile_firefox_nopassword_59")
self.run_firefox_nopassword()
if __name__ == "__main__":
from simpletap import TAPTestRunner
unittest.main(testRunner=TAPTestRunner(buffer=True), exit=False)
# vim: ai sts=4 et sw=4