Skip to content

Commit a1bf5c3

Browse files
[TBT-381] Feedback incorporated
1 parent ab5b727 commit a1bf5c3

File tree

5 files changed

+11
-18
lines changed

5 files changed

+11
-18
lines changed

lib/travis/api/app/endpoint/assembla.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ def deep_integration_enabled?
5757
end
5858

5959
def valid_asm_cluster?
60-
allowed = Array(Travis.config.assembla_clusters.to_s.split(','))
61-
cluster = request.env[CLUSTER_HEADER]
62-
allowed.include?(cluster)
60+
allowed = Travis.config.assembla_clusters.to_s.split(',')
61+
allowed.include?(request.env[CLUSTER_HEADER])
6362
end
6463
end
6564
end

lib/travis/api/app/jwt_utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def verify_jwt(request)
1010
halt 401, { error: "Missing JWT" } unless token
1111

1212
begin
13-
decoded, = JWT.decode(token, Travis.config.assembla_jwt_secret, true, algorithm: 'HS256' )
13+
decoded, = JWT.decode(token, Travis.config.assembla_jwt_secret, true, algorithm: 'HS256')
1414
decoded
1515
rescue JWT::DecodeError => e
1616
halt 401, { error: "Invalid JWT: #{e.message}" }

lib/travis/config/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def fallback_logs_api_auth_token
110110
assembla_clusters: 'eu, us',
111111
deep_integration_enabled: false,
112112
assembla_jwt_secret: 'assembla_jwt_secret',
113-
beta_plan_name: 'beta_plan'
113+
deep_integration_beta_plan_name: 'beta_plan'
114114

115115
default :_access => [:key]
116116

lib/travis/services/assembla_user_service.rb

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ module Services
33
class AssemblaUserService
44
class SyncError < StandardError; end
55

6-
BILLING_COUNTRY = 'Poland'
7-
BILLING_ADDRESS = "System-generated for user %{login} (%{id})"
8-
BILLING_CITY = "AutoCity-%{id}"
9-
BILLING_ZIP = "000%{id}"
10-
116
def initialize(payload)
127
@payload = payload
138
end
@@ -50,7 +45,7 @@ def sync_user(user_id)
5045

5146
def subscription_params(user, organization_id)
5247
{
53-
'plan' => Travis.config.beta_plan_name,
48+
'plan' => Travis.config.deep_integration_plan_name,
5449
'organization_id' => organization_id,
5550
'billing_info' => billing_info(user),
5651
'credit_card_info' => { 'token' => nil }
@@ -59,12 +54,12 @@ def subscription_params(user, organization_id)
5954

6055
def billing_info(user)
6156
{
62-
'address' => BILLING_ADDRESS % { login: user.login, id: user.id },
63-
'city' => BILLING_CITY % { id: user.id },
64-
'country' => BILLING_COUNTRY,
57+
'address' => 'Dummy Address',
58+
'city' => 'Dummy City',
59+
'country' => 'Dummy Country',
6560
'first_name' => user.name&.split&.first,
6661
'last_name' => user.name&.split&.last,
67-
'zip_code' => BILLING_ZIP % { id: user.id },
62+
'zip_code' => 'DUMMY ZIP',
6863
'billing_email' => user.email
6964
}
7065
end

spec/lib/services/assembla_user_service_spec.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'spec_helper'
2-
require 'factory_bot'
32

43
RSpec.describe Travis::Services::AssemblaUserService do
54
let(:payload) do
@@ -83,8 +82,8 @@
8382

8483
result = service.create_org_subscription(user, organization.id)
8584
expect(result[:error]).to be_truthy
86-
expect(result[:details]).to be_present
85+
expect(result[:details]).to eq(error.message)
8786
end
8887
end
8988
end
90-
end
89+
end

0 commit comments

Comments
 (0)