Path: blob/master/spec/app/finders/users/author_sitemap_spec.rb
1483 views
# frozen_string_literal: true12describe WPScan::Finders::Users::AuthorSitemap do3subject(:finder) { described_class.new(target) }4let(:target) { WPScan::Target.new(url) }5let(:url) { 'http://wp.lab/' }6let(:fixtures) { FINDERS_FIXTURES.join('users', 'author_sitemap') }78describe '#aggressive' do9before do10allow(target).to receive(:sub_dir).and_return(false)1112stub_request(:get, finder.sitemap_url).to_return(body: body)13end1415context 'when not an XML response' do16let(:body) { '' }1718its(:aggressive) { should eql([]) }19end2021context 'when an XML response' do22context 'when no usernames disclosed' do23let(:body) { File.read(fixtures.join('no_usernames.xml')) }2425its(:aggressive) { should eql([]) }26end2728context 'when usernames disclosed' do29let(:body) { File.read(fixtures.join('usernames.xml')) }3031it 'returns the expected array of users' do32users = finder.aggressive3334expect(users.size).to eql 23536expect(users.first.username).to eql 'admin'37expect(users.first.confidence).to eql 10038expect(users.first.interesting_entries).to eql ['http://wp.lab/wp-sitemap-users-1.xml']3940expect(users.last.username).to eql 'author'41expect(users.last.confidence).to eql 10042expect(users.last.interesting_entries).to eql ['http://wp.lab/wp-sitemap-users-1.xml']43end44end45end46end47end484950