Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wpscanteam
GitHub Repository: wpscanteam/wpscan
Path: blob/master/spec/app/finders/main_theme/urls_in_homepage_spec.rb
1483 views
1
# frozen_string_literal: true
2
3
describe WPScan::Finders::MainTheme::UrlsInHomepage do
4
subject(:finder) { described_class.new(target) }
5
let(:target) { WPScan::Target.new(url) }
6
let(:url) { 'http://wp.lab/' }
7
let(:fixtures) { FINDERS_FIXTURES.join('main_theme', 'urls_in_homepage') }
8
9
it_behaves_like 'App::Finders::WpItems::UrlsInPage' do
10
let(:page_url) { url }
11
let(:type) { 'themes' }
12
let(:uniq_links) { false }
13
let(:uniq_codes) { false }
14
let(:expected_from_links) { %w[twentyfifteen twentyfifteen twentyfifteen yolo] }
15
let(:expected_from_codes) { %w[test yolo] }
16
end
17
18
describe '#passive' do
19
before do
20
stub_request(:get, /.*.css/)
21
stub_request(:get, target.url).to_return(body: File.read(fixtures.join('found.html')))
22
23
allow(target).to receive(:content_dir).and_return('wp-content')
24
end
25
26
it 'returns the expected Themes' do
27
@expected = []
28
29
{ 'twentyfifteen' => 6, 'yolo' => 4, 'test' => 2 }.each do |slug, confidence|
30
@expected << WPScan::Model::Theme.new(
31
slug, target, found_by: 'Urls In Homepage (Passive Detection)', confidence: confidence
32
)
33
end
34
35
expect(finder.passive).to eql @expected
36
end
37
end
38
end
39
40