Merge pull request #9730 from chrisroberts/f-smb-urls
Return original URL value when unmodified
This commit is contained in:
commit
6fb293736e
|
@ -38,8 +38,10 @@ module VagrantPlugins
|
|||
u = URI.parse(url)
|
||||
if u.host != TARGET_HOST && REPLACEMENT_HOSTS.include?(u.host)
|
||||
u.host = TARGET_HOST
|
||||
u.to_s
|
||||
else
|
||||
url
|
||||
end
|
||||
u.to_s
|
||||
end
|
||||
|
||||
server_uri = URI.parse(Vagrant.server_url.to_s)
|
||||
|
|
|
@ -125,6 +125,22 @@ describe VagrantPlugins::LoginCommand::AddAuthentication do
|
|||
end
|
||||
end
|
||||
|
||||
it "returns original urls when not modified" do
|
||||
to_persist = "file:////path/to/box.box"
|
||||
to_change = VagrantPlugins::LoginCommand::AddAuthentication::
|
||||
REPLACEMENT_HOSTS.map{ |h| "http://#{h}/box.box" }.first
|
||||
expected = "http://#{VagrantPlugins::LoginCommand::AddAuthentication::TARGET_HOST}/box.box"
|
||||
env[:box_urls] = [to_persist, to_change]
|
||||
subject.call(env)
|
||||
check_persist, check_change = env[:box_urls]
|
||||
expect(check_change).to eq(expected)
|
||||
expect(check_persist).to eq(to_persist)
|
||||
# NOTE: The behavior of URI.parse changes on Ruby 2.5 to produce
|
||||
# the same string value. To make the test worthwhile in checking
|
||||
# for the same value, check that the object IDs are still the same.
|
||||
expect(check_persist.object_id).to eq(to_persist.object_id)
|
||||
end
|
||||
|
||||
it "does not append multiple access_tokens" do
|
||||
token = "foobarbaz"
|
||||
VagrantPlugins::LoginCommand::Client.new(iso_env).store_token(token)
|
||||
|
|
Loading…
Reference in New Issue