-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathconnection_spec.rb
40 lines (33 loc) · 1.26 KB
/
connection_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# encoding: UTF-8
#
# Copyright (c) 2010-2018 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
require_relative '../helpers/connection_helper'
describe GoodData, :vcr, :vcr_all_cassette => 'sso' do
let(:login) { '[email protected]' }
KEYS = ['dev-gooddata-sso.pub', 'rubydev_public.gpg', 'rubydev_secret_keys.gpg']
before do
cipher = ENV['GD_SPEC_PASSWORD'] || ENV['BIA_ENCRYPTION_KEY']
KEYS.each do |key|
File.write(key, GoodData::Helpers.decrypt(File.read(key + '.encrypted'), cipher))
end
`gpg --import #{KEYS.join(' ')}`
live_api = GoodData::Environment::VCR_ON == false || VCR.current_cassette.recording?
allow(GoodData).to receive(:system) { true } unless live_api
end
it 'can use SSO' do
rest_client = GoodData.connect_sso(
login,
'test-ruby',
GoodData::Environment::ConnectionHelper::DEFAULT_SERVER,
server: GoodData::Environment::ConnectionHelper::DEFAULT_SERVER,
verify_ssl: false
)
res = rest_client.get(GoodData::Environment::ConnectionHelper::DEFAULT_USER_URL)
expect(res).to be_truthy
end
after do
KEYS.each { |key| File.delete(key) }
end
end