Commit 7de8312d authored by Gabriel Mazetto's avatar Gabriel Mazetto

Fixed oauth_callback_url

parent df232c27
...@@ -56,6 +56,10 @@ class GeoNode < ActiveRecord::Base ...@@ -56,6 +56,10 @@ class GeoNode < ActiveRecord::Base
URI.join(uri, "#{uri.path}/", "api/#{API::API.version}/geo/refresh_projects").to_s URI.join(uri, "#{uri.path}/", "api/#{API::API.version}/geo/refresh_projects").to_s
end end
def oauth_callback_url
URI.join(uri, "#{uri.path}/", 'oauth/geo/callback').to_s
end
def missing_oauth_application? def missing_oauth_application?
self.primary? ? false : !oauth_application.present? self.primary? ? false : !oauth_application.present?
end end
...@@ -94,8 +98,4 @@ class GeoNode < ActiveRecord::Base ...@@ -94,8 +98,4 @@ class GeoNode < ActiveRecord::Base
record.errors[:base] << 'Current node must be the primary node or you will be locking yourself out' record.errors[:base] << 'Current node must be the primary node or you will be locking yourself out'
end end
end end
def oauth_callback_url
URI.join(uri, "#{uri.path}/", 'oauth', 'geo', 'callback').to_s
end
end end
...@@ -155,6 +155,15 @@ describe GeoNode, type: :model do ...@@ -155,6 +155,15 @@ describe GeoNode, type: :model do
end end
end end
describe '#oauth_callback_url' do
let(:oauth_callback_url) { 'https://localhost:3000/gitlab/oauth/geo/callback' }
it 'returns oauth callback url based on node uri' do
expect(new_node.oauth_callback_url).to eq(oauth_callback_url)
end
end
describe '#missing_oauth_application?' do describe '#missing_oauth_application?' do
context 'on a primary node' do context 'on a primary node' do
it 'returns false' do it 'returns false' do
......
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