Skip to content

Commit

Permalink
Merge pull request #13666 from opf/bug/49781-enterprise-trial-automat…
Browse files Browse the repository at this point in the history
…ic-activation-does-not-work

[49781] Allow trial creation in development mode
  • Loading branch information
machisuji committed Sep 11, 2023
2 parents 3c3dbb2 + b4940d5 commit 18f0f1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/constants/settings/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ class Definition
# Allow connections for trial creation and booking
enterprise_trial_creation_host: {
description: 'Host for EE trial service',
default: 'https://augur.openproject.com',
default: 'https://start.openproject.com',
writable: false
},
enterprise_chargebee_site: {
Expand Down
2 changes: 1 addition & 1 deletion lib_static/open_project/configuration/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def enterprise_trial_creation_host
if Rails.env.production?
self['enterprise_trial_creation_host']
else
'https://augur.openproject-edge.com'
'https://start.openproject-edge.com'
end
end

Expand Down
28 changes: 14 additions & 14 deletions spec/features/admin/enterprise/enterprise_trial_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
{
self:
{
href: "https://augur.openproject-edge.com/public/v1/trials/#{trial_id}"
href: "https://start.openproject-edge.com/public/v1/trials/#{trial_id}"
},
details:
{
href: "https://augur.openproject-edge.com/public/v1/trials/#{trial_id}/details"
href: "https://start.openproject-edge.com/public/v1/trials/#{trial_id}/details"
}
}
}
Expand All @@ -59,11 +59,11 @@
description: "User has to confirm their email address",
_links: {
resend: {
href: "https://augur.openproject-edge.com/public/v1/trials/#{trial_id}/resend",
href: "https://start.openproject-edge.com/public/v1/trials/#{trial_id}/resend",
method: "POST"
},
details: {
href: "https://augur.openproject-edge.com/public/v1/trials/#{trial_id}/details"
href: "https://start.openproject-edge.com/public/v1/trials/#{trial_id}/details"
}
}
}
Expand Down Expand Up @@ -122,7 +122,7 @@
token_retrieved: false,
_links: {
self: {
href: "https://augur.openproject-edge.com/public/v1/trials/#{trial_id}"
href: "https://start.openproject-edge.com/public/v1/trials/#{trial_id}"
}
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ def fill_out_modal(mail: 'foo@foocorp.example')
end

it 'blocks the request assuming the mail was used' do
proxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')
proxy.stub('https://start.openproject-edge.com:443/public/v1/trials', method: 'post')
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 422, body: mail_in_use_body.to_json)

find('.button', text: 'Start free trial').click
Expand All @@ -188,7 +188,7 @@ def fill_out_modal(mail: 'foo@foocorp.example')
end

it 'blocks the request assuming the domain was used' do
proxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')
proxy.stub('https://start.openproject-edge.com:443/public/v1/trials', method: 'post')
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 422, body: domain_in_use_body.to_json)

find('.button', text: 'Start free trial').click
Expand All @@ -201,7 +201,7 @@ def fill_out_modal(mail: 'foo@foocorp.example')
end

it 'shows an error in case of other errors' do
proxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')
proxy.stub('https://start.openproject-edge.com:443/public/v1/trials', method: 'post')
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 409, body: other_error_body.to_json)

find('.button', text: 'Start free trial').click
Expand All @@ -214,13 +214,13 @@ def fill_out_modal(mail: 'foo@foocorp.example')

context 'with a waiting request pending' do
before do
proxy.stub('https://augur.openproject-edge.com:443/public/v1/trials', method: 'post')
proxy.stub('https://start.openproject-edge.com:443/public/v1/trials', method: 'post')
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: created_body.to_json)

proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}")
proxy.stub("https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}")
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 422, body: waiting_body.to_json)

proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}/resend", method: 'post')
proxy.stub("https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}/resend", method: 'post')
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: waiting_body.to_json)

find('.button', text: 'Start free trial').click
Expand All @@ -238,11 +238,11 @@ def fill_out_modal(mail: 'foo@foocorp.example')
# Stub with successful body
# Stub the proxy to a successful return
# which marks the user has confirmed the mail link
proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}")
proxy.stub("https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}")
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: confirmed_body.to_json)

# Stub the details URL to still return 403
proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}/details")
proxy.stub("https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}/details")
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 403)

visit enterprise_path
Expand All @@ -264,7 +264,7 @@ def fill_out_modal(mail: 'foo@foocorp.example')

# Stub the proxy to a successful return
# which marks the user has confirmed the mail link
proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}")
proxy.stub("https://start.openproject-edge.com:443/public/v1/trials/#{trial_id}")
.and_return(headers: { 'Access-Control-Allow-Origin' => '*' }, code: 200, body: confirmed_body.to_json)

# Wait until the next request
Expand Down

0 comments on commit 18f0f1c

Please sign in to comment.