Commit bbb67df4 authored by Nick Thomas's avatar Nick Thomas

Treat licenses with no plan specified as EES

parent a69be90a
......@@ -187,7 +187,7 @@ class License < ActiveRecord::Base
end
def plan
restricted_attr(:plan)
restricted_attr(:plan, STARTER_PLAN)
end
def current_active_users_count
......
......@@ -344,6 +344,20 @@ describe License do
end
describe 'reading add-ons' do
describe '#plan' do
it 'interprets no plan as EES' do
license = build(:license, data: build(:gitlab_license, restrictions: { add_ons: {} }).export)
expect(license.plan).to eq(License::STARTER_PLAN)
end
it 'interprets an unknown plan as unknown' do
license = build_license_with_add_ons({}, plan: 'unknown')
expect(license.plan).to eq('unknown')
end
end
describe '#add_ons' do
context 'without add-ons' do
it 'returns an empty Hash' do
......
......@@ -17,7 +17,7 @@ describe API::License, api: true do
expect(Date.parse(json_response['expires_at'])).to eq Date.today + 11.months
expect(json_response['active_users']).to eq 1
expect(json_response['licensee']).not_to be_empty
expect(json_response['add_ons']).to eq({ 'GitLab_FileLocks' => 1, 'GitLab_Auditor_User' => 1 })
expect(json_response['add_ons']).to eq(license.add_ons)
end
it 'denies access if not admin' 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