mirror of
https://github.com/StrawberryMaster/wayback-machine-downloader.git
synced 2025-12-17 17:56:44 +00:00
Fix exact match logic and add a test
This commit is contained in:
parent
e166e9443d
commit
4af80adca6
@ -87,15 +87,13 @@ class WaybackMachineDownloader
|
||||
snapshot_list_to_consider += get_raw_list_from_api(@base_url, nil)
|
||||
print "."
|
||||
unless @exact_match
|
||||
snapshot_list_to_consider += get_raw_list_from_api(@base_url + '/*', nil)
|
||||
print "."
|
||||
end
|
||||
@maximum_pages.times do |page_index|
|
||||
snapshot_list = get_raw_list_from_api(@base_url + '/*', page_index)
|
||||
break if snapshot_list.empty?
|
||||
snapshot_list_to_consider += snapshot_list
|
||||
print "."
|
||||
end
|
||||
end
|
||||
puts " found #{snapshot_list_to_consider.lines.count} snaphots to consider."
|
||||
puts
|
||||
snapshot_list_to_consider
|
||||
|
||||
@ -39,6 +39,16 @@ class WaybackMachineDownloaderTest < Minitest::Test
|
||||
assert_equal file_expected, @wayback_machine_downloader.get_file_list_by_timestamp[-2]
|
||||
end
|
||||
|
||||
def test_without_exact_match
|
||||
@wayback_machine_downloader.exact_match = false
|
||||
assert @wayback_machine_downloader.get_file_list_curated.size > 1
|
||||
end
|
||||
|
||||
def test_exact_match
|
||||
@wayback_machine_downloader.exact_match = true
|
||||
assert_equal 1, @wayback_machine_downloader.get_file_list_curated.size
|
||||
end
|
||||
|
||||
def test_file_list_only_filter_without_matches
|
||||
@wayback_machine_downloader.only_filter = 'abc123'
|
||||
assert_equal 0, @wayback_machine_downloader.get_file_list_curated.size
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user