From bb59287bea9f7a77af7bcb8c5bc44f4a54d167b6 Mon Sep 17 00:00:00 2001 From: hartator Date: Sat, 30 Jul 2016 14:09:46 -0500 Subject: [PATCH] Add test for to and from timestamp parameter --- test/test_wayback_machine_downloader.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/test_wayback_machine_downloader.rb b/test/test_wayback_machine_downloader.rb index 8066945..717b0e9 100644 --- a/test/test_wayback_machine_downloader.rb +++ b/test/test_wayback_machine_downloader.rb @@ -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