def test_chrome_two_proflies_one_invalid(tests_root): profile_rootpath = Path(tests_root, 'chrome_databases') browser_name = 'chrome' table_name = 'urls' profile_names = ['Profile 1 JUNK', 'Profile 2'] file_name = 'History' expected_browser_paths = {'Profile 2': Path(profile_rootpath, 'Profile 2')} actual_browser_paths = make_browser_paths( browser=browser_name, profile_root=profile_rootpath, profiles=profile_names, ) urls_records_yielder = make_browser_records_yielder( browser=browser_name, profile_root=profile_rootpath, filename=file_name, tablename=table_name, profiles=profile_names, ) actual_records = list(urls_records_yielder) assert expected_browser_paths == actual_browser_paths assert len(actual_records) == 9 assert [record['id'] for record in actual_records] == list(range(1, 10)) assert actual_records[5]['id'] == 6 assert actual_records[5]['url'] == 'https://about.gitlab.com/' assert actual_records[-1]['id'] == 9 assert actual_records[-1][ 'url'] == 'https://www.howtogeek.com/255653/how-to-find-your-chrome-profile-folder-on-windows-mac-and-linux/'
def test_firefox_two_proflies_one_invalid(tests_root): profile_rootpath = Path(tests_root, 'firefox_databases') browser_name = 'firefox' table_name = 'moz_places' profile_names = ['test_profile1_JUNK', 'test_profile2'] file_name = 'places.sqlite' expected_browser_paths = { 'test_profile2': Path(profile_rootpath, 'z786c76dv78.test_profile2') } actual_browser_paths = make_browser_paths( browser=browser_name, profile_root=profile_rootpath, profiles=profile_names, ) moz_places_records_yielder = make_browser_records_yielder( browser=browser_name, profile_root=profile_rootpath, filename=file_name, tablename=table_name, profiles=profile_names, ) actual_records = list(moz_places_records_yielder) assert expected_browser_paths == actual_browser_paths assert len(actual_records) == 20 assert [record['id'] for record in actual_records] == list(range(1, 21)) assert actual_records[0]['url'] == 'http://www.linuxmint.com/start/tessa' assert actual_records[-1]['id'] == 20 assert actual_records[-1]['url'] == 'https://www.youtube.com/'
def test_browser_chrome_make_paths_during_init_one_profile(tests_root): profile_rootpath = Path(tests_root, 'chrome_databases') browser_name = 'chrome' profile_name = 'Profile 1' browser_profile1 = make_browser_paths(browser=browser_name, profile_root=profile_rootpath, profiles=[profile_name], ) expected_paths = {'Profile 1': Path(profile_rootpath, 'Profile 1')} assert browser_profile1.keys() == expected_paths.keys() for profile_name in browser_profile1: assert browser_profile1[profile_name] == expected_paths[ profile_name]
def test_browser_firefox_make_paths_during_init_one_profile(tests_root): profile_rootpath = Path(tests_root, 'firefox_databases') browser_name = 'firefox' profile_name = 'test_profile1' profile1_browser_paths = make_browser_paths(browser=browser_name, profile_root=profile_rootpath, profiles=[profile_name], ) expected_paths = { 'test_profile1': Path(profile_rootpath, 't87e6f86.test_profile1') } assert profile1_browser_paths.keys() == expected_paths.keys() for profile_name in profile1_browser_paths: assert profile1_browser_paths[profile_name] == expected_paths[ profile_name]
def test_browser_firefox_make_paths_during_init_two_profiles(tests_root): profile_rootpath = Path(tests_root, 'firefox_databases') browser_name = 'firefox' profile_names = ['test_profile1', 'test_profile2'] browser_profile1 = make_browser_paths(browser=browser_name, profile_root=profile_rootpath, profiles=profile_names, ) expected_paths = { 'test_profile1': Path(profile_rootpath, 't87e6f86.test_profile1'), 'test_profile2': Path(profile_rootpath, 'z786c76dv78.test_profile2'), } assert browser_profile1.keys() == expected_paths.keys() for profile_name in browser_profile1: assert browser_profile1[profile_name] == expected_paths[profile_name]
def test_firefox_invalid_proflie(tests_root): profile_rootpath = Path(tests_root, 'firefox_databases') browser_name = 'firefox' table_name = 'moz_places' profile_name = ['test_profile1_JUNK'] file_name = 'places.sqlite' actual_browser_paths = make_browser_paths( browser=browser_name, profile_root=profile_rootpath, profiles=profile_name, ) moz_places_records_yielder = make_browser_records_yielder( browser=browser_name, profile_root=profile_rootpath, filename=file_name, tablename=table_name, profiles=profile_name, ) yielded_records = list(moz_places_records_yielder) assert actual_browser_paths == {} assert yielded_records == []
def test_chrome_invalid_proflie(tests_root): profile_rootpath = Path(tests_root, 'chrome_databases') browser_name = 'chrome' table_name = 'urls' profile_name = ['Profile 1 JUNK'] file_name = 'History' actual_browser_paths = make_browser_paths( browser=browser_name, profile_root=profile_rootpath, profiles=profile_name, ) urls_records_yielder = make_browser_records_yielder( browser=browser_name, profile_root=profile_rootpath, filename=file_name, tablename=table_name, profiles=profile_name, ) yielded_records = list(urls_records_yielder) assert actual_browser_paths == {} assert yielded_records == []