mirror of
https://github.com/StrawberryMaster/wayback-machine-downloader.git
synced 2025-12-17 17:56:44 +00:00
Add test for to and from timestamp parameter
This commit is contained in:
parent
30302eb214
commit
bb59287bea
@ -22,9 +22,9 @@ class WaybackMachineDownloaderTest < Minitest::Test
|
||||
|
||||
def test_file_list_by_timestamp
|
||||
file_expected = {
|
||||
file_id: "Fs-06.jpg",
|
||||
file_url: "http://www.onlyfreegames.net:80/Fs-06.jpg",
|
||||
timestamp: 20060716125343
|
||||
file_id: "page.html",
|
||||
file_url: "http://www.onlyfreegames.net:80/page.html",
|
||||
timestamp: 20060713153753
|
||||
}
|
||||
assert_equal file_expected, @wayback_machine_downloader.get_file_list_by_timestamp[-1]
|
||||
end
|
||||
@ -46,17 +46,17 @@ class WaybackMachineDownloaderTest < Minitest::Test
|
||||
|
||||
def test_file_list_exclude_filter_without_matches
|
||||
@wayback_machine_downloader.exclude_filter = 'abc123'
|
||||
assert_equal 69, @wayback_machine_downloader.get_file_list_curated.size
|
||||
assert_equal 68, @wayback_machine_downloader.get_file_list_curated.size
|
||||
end
|
||||
|
||||
def test_file_list_exclude_filter_with_1_match
|
||||
@wayback_machine_downloader.exclude_filter = 'menu.html'
|
||||
assert_equal 68, @wayback_machine_downloader.get_file_list_curated.size
|
||||
assert_equal 67, @wayback_machine_downloader.get_file_list_curated.size
|
||||
end
|
||||
|
||||
def test_file_list_exclude_filter_with_a_regex
|
||||
@wayback_machine_downloader.exclude_filter = '/\.(gif|je?pg|bmp)$/i'
|
||||
assert_equal 32, @wayback_machine_downloader.get_file_list_curated.size
|
||||
assert_equal 31, @wayback_machine_downloader.get_file_list_curated.size
|
||||
end
|
||||
|
||||
def test_file_download
|
||||
@ -65,8 +65,14 @@ class WaybackMachineDownloaderTest < Minitest::Test
|
||||
assert_includes linux_page.read, "Linux Games"
|
||||
end
|
||||
|
||||
def test_timestamp_being_respected
|
||||
@wayback_machine_downloader.timestamp = 20050716231334
|
||||
def test_from_timestamp_being_respected
|
||||
@wayback_machine_downloader.from_timestamp = 20050716231334
|
||||
file_url = @wayback_machine_downloader.get_file_list_curated["linux.htm"][:file_url]
|
||||
assert_equal "http://www.onlyfreegames.net/linux.htm", file_url
|
||||
end
|
||||
|
||||
def test_to_timestamp_being_respected
|
||||
@wayback_machine_downloader.to_timestamp = 20050716231334
|
||||
assert_nil @wayback_machine_downloader.get_file_list_curated["linux.htm"]
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user