Skip to content
Snippets Groups Projects
Commit aa0a36a2 authored by Valery Sizov's avatar Valery Sizov
Browse files

Make Network class to follow HTTP RFC

parent 6d811a64
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7,7 +7,7 @@ class Network
 
def authenticate(api_opts)
opts = {
body: api_opts.to_json
query: api_opts
}
 
endpoint = File.join(url, API_PREFIX, 'user')
Loading
Loading
Loading
Loading
@@ -5,13 +5,7 @@ describe API::API do
 
let(:project) { FactoryGirl.create(:project) }
let(:gitlab_url) { GitlabCi.config.gitlab_server.url }
let(:auth_opts) {
{
email: "test@test.com",
password: "123456"
}
}
let(:private_token) { Network.new.authenticate(auth_opts)["private_token"] }
let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] }
 
let(:options) {
{
Loading
Loading
Loading
Loading
@@ -4,13 +4,7 @@ describe API::API do
include ApiHelpers
 
let(:gitlab_url) { GitlabCi.config.gitlab_server.url }
let(:auth_opts) {
{
email: "test@test.com",
password: "123456"
}
}
let(:private_token) { Network.new.authenticate(auth_opts)["private_token"] }
let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] }
 
let(:options) {
{
Loading
Loading
Loading
Loading
@@ -10,14 +10,7 @@ describe API::API do
 
describe "GET /runners" do
let(:gitlab_url) { GitlabCi.config.gitlab_server.url }
let(:auth_opts) {
{
:email => "test@test.com",
:password => "123456"
}
}
let(:private_token) { Network.new.authenticate(auth_opts)["private_token"] }
let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] }
let(:options) {
{
:private_token => private_token,
Loading
Loading
Loading
Loading
@@ -40,7 +40,7 @@ module StubGitlabCalls
def stub_oauth_user
f = File.read(Rails.root.join('spec/support/gitlab_stubs/user.json'))
 
stub_request(:get, "#{gitlab_url}api/v3/user").
stub_request(:get, "#{gitlab_url}api/v3/user?access_token=some_token").
with(:headers => {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => f, :headers => {'Content-Type'=>'application/json'})
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment