|
|
|
@ -253,7 +253,7 @@ describe Carto::ApiKey do
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'shows public tables' do
|
|
|
|
|
api_key = @carto_user1.api_keys.find_by_type(Carto::ApiKey::TYPE_DEFAULT_PUBLIC)
|
|
|
|
|
api_key = @carto_user1.api_keys.default_public.first
|
|
|
|
|
|
|
|
|
|
api_key_permissions(api_key, @public_table.database_schema, @public_table.name).permissions.should eq ['select']
|
|
|
|
|
end
|
|
|
|
@ -261,7 +261,7 @@ describe Carto::ApiKey do
|
|
|
|
|
|
|
|
|
|
describe 'master api key' do
|
|
|
|
|
it 'user has a master key with the user db_role' do
|
|
|
|
|
api_key = @carto_user1.api_keys.find_by_type(Carto::ApiKey::TYPE_MASTER)
|
|
|
|
|
api_key = @carto_user1.api_keys.master.first
|
|
|
|
|
api_key.should be
|
|
|
|
|
api_key.db_role.should eq @carto_user1.database_username
|
|
|
|
|
api_key.db_password.should eq @carto_user1.database_password
|
|
|
|
@ -280,7 +280,7 @@ describe Carto::ApiKey do
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'token must match user api key' do
|
|
|
|
|
api_key = @carto_user1.api_keys.find_by_type(Carto::ApiKey::TYPE_MASTER)
|
|
|
|
|
api_key = @carto_user1.api_keys.master.first
|
|
|
|
|
api_key.token = 'wadus'
|
|
|
|
|
api_key.save.should be_false
|
|
|
|
|
api_key.errors.full_messages.should include "Token must match user model for master keys"
|
|
|
|
@ -289,7 +289,7 @@ describe Carto::ApiKey do
|
|
|
|
|
|
|
|
|
|
describe 'default public api key' do
|
|
|
|
|
it 'user has a default public key with the public_db_user role' do
|
|
|
|
|
api_key = @carto_user1.api_keys.find_by_type(Carto::ApiKey::TYPE_DEFAULT_PUBLIC)
|
|
|
|
|
api_key = @carto_user1.api_keys.default_public.first
|
|
|
|
|
api_key.should be
|
|
|
|
|
api_key.db_role.should eq @carto_user1.database_public_username
|
|
|
|
|
api_key.db_password.should eq CartoDB::PUBLIC_DB_USER_PASSWORD
|
|
|
|
@ -308,7 +308,7 @@ describe Carto::ApiKey do
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'cannot change token' do
|
|
|
|
|
api_key = @carto_user1.api_keys.find_by_type(Carto::ApiKey::TYPE_DEFAULT_PUBLIC)
|
|
|
|
|
api_key = @carto_user1.api_keys.default_public.first
|
|
|
|
|
api_key.token = 'wadus'
|
|
|
|
|
api_key.save.should be_false
|
|
|
|
|
api_key.errors.full_messages.should include "Token must be default_public for default public keys"
|
|
|
|
|