Commit 55959477 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'api-v3-ip-blocker-test' into 'master'

Add test for IP blocker in API v3 github endpoint

See merge request gitlab-org/gitlab!57262
parents a076b958 22e018e2
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::V3::Github do
describe 'GET /repos/:namespace/:project/pulls' do
let_it_be(:private_group) { create(:group, :private) }
let_it_be(:ip_restriction) { create(:ip_restriction, group: private_group) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :repository, creator: user, group: private_group) }
let(:user_agent) { 'Jira DVCS Connector/3.2.4' }
let(:path) { "/repos/#{project.namespace.path}/#{project.path}/pulls" }
before do
private_group.add_maintainer(user)
end
it 'returns status 200' do
get api(path, user, version: 'v3'), headers: { 'User-Agent' => user_agent }
expect(response).to have_gitlab_http_status(:ok)
end
context 'group_ip_restriction' do
before do
stub_licensed_features(group_ip_restriction: true)
end
it 'returns 404 for request from ip not in the range' do
get api(path, user, version: 'v3'), headers: { 'User-Agent' => user_agent }
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment