Sha256: e7a7b66de66599626e27318f34d368f540ee4a78e6189b6646b8b6b56eb54a56

Contents?: true

Size: 1.82 KB

Versions: 3

Compression:

Stored size: 1.82 KB

Contents

require 'webrick'
require File.dirname(__FILE__) + '/../lib/yawast'
require File.dirname(__FILE__) + '/base'

class TestScannerApacheServerStatus < Minitest::Test
  include TestBase

  def test_readme_html_present
    port = rand(60000) + 1024 # pick a random port number
    server = start_web_server File.dirname(__FILE__) + '/data/wordpress_readme_html.txt', 'readme.html', port

    override_stdout
    uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"])

    Yawast::Shared::Http.setup nil, nil
    Yawast::Scanner::Plugins::Http::FilePresence.check_readme_html uri

    assert stdout_value.include?('\'/readme.html\' found:'), 'readme.html page warning not found'

    server.exit
    restore_stdout
  end

  def test_readme_html_present_all
    port = rand(60000) + 1024 # pick a random port number
    server = start_web_server File.dirname(__FILE__) + '/data/wordpress_readme_html.txt', 'readme.html', port

    override_stdout
    uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"])

    Yawast::Shared::Http.setup nil, nil
    Yawast::Scanner::Plugins::Http::FilePresence.check_all uri

    assert stdout_value.include?('\'/readme.html\' found:'), 'readme.html page warning not found'

    server.exit
    restore_stdout
  end

  def test_release_notes_txt_present
    port = rand(60000) + 1024 # pick a random port number
    server = start_web_server File.dirname(__FILE__) + '/data/tomcat_release_notes.txt', 'RELEASE-NOTES.txt', port

    override_stdout
    uri = Yawast::Commands::Utils.extract_uri(["http://localhost:#{port}"])

    Yawast::Shared::Http.setup nil, nil
    Yawast::Scanner::Plugins::Http::FilePresence.check_release_notes_txt uri

    assert stdout_value.include?('\'/RELEASE-NOTES.txt\' found:'), 'RELEASE-NOTES.txt page warning not found'

    server.exit
    restore_stdout
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yawast-0.5.0.beta1 test/test_object_presence.rb
yawast-0.4.0 test/test_object_presence.rb
yawast-0.4.0.beta5 test/test_object_presence.rb