Handle Central API credentials presence in specs - #1134

pull/1179/head
Jose A. Rilla 10 years ago
parent 496cbff3c4
commit fea280ef5c

@ -151,6 +151,11 @@ defaults: &defaults
style: ""
cartodb_com_hosted: true
cartodb_central_domain_name: 'cartodb.com'
cartodb_central_api:
host: 'fake.url'
port: 9999
username: 'api'
password: 'test'
aws:
s3:
access_key_id: "test"

@ -1,23 +1,37 @@
require 'spec_helper'
require_relative '../../lib/cartodb/central'
def config_present?
Cartodb.config[:cartodb_central_api].present? &&
Cartodb.config[:cartodb_central_api]['username'].present? &&
Cartodb.config[:cartodb_central_api]['password'].present?
end
describe Cartodb::Central do
before(:all) do
@organization = create_organization_with_users(name: 'test-org')
@user = @organization.users.first
@user.username = 'user1'
@user.save
@cartodb_central_client = Cartodb::Central.new
@org_path = "/api/organizations/#{ @organization.name }"
@users_path = "#{ @org_path }/users"
@user_path = "#{ @users_path }/#{ @user.username }"
if config_present?
@organization = create_organization_with_users(name: 'test-org')
@user = @organization.users.first
@user.username = 'user1'
@user.save
@cartodb_central_client = Cartodb::Central.new
@org_path = "/api/organizations/#{ @organization.name }"
@users_path = "#{ @org_path }/users"
@user_path = "#{ @users_path }/#{ @user.username }"
end
end
after(:all) do
@user.destroy
@user && @user.destroy
end
describe "Central synchronization client" do
before(:each) do
pending "Central API credentials not present in app_config.yml" unless config_present?
end
describe "Organization users" do
it "gets all users from an organization" do
request = @cartodb_central_client.build_request(@users_path, nil, :get)

Loading…
Cancel
Save