-
Notifications
You must be signed in to change notification settings - Fork 125
Expand file tree
/
Copy pathlcm_spec.rb
More file actions
54 lines (45 loc) · 2.17 KB
/
lcm_spec.rb
File metadata and controls
54 lines (45 loc) · 2.17 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# encoding: UTF-8
#
# Copyright (c) 2010-2017 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 'gooddata'
describe GoodData::LCM, :vcr, :constraint => 'slow' do
before(:all) do
@client = ConnectionHelper.create_default_connection
spec = JSON.parse(File.read("./spec/data/blueprints/attribute_sort_order_blueprint.json"), :symbolize_names => true)
blueprint = GoodData::Model::ProjectBlueprint.new(spec)
@source_project = @client.create_project_from_blueprint(blueprint, token: ConnectionHelper::SECRETS[:gd_project_token], environment: ProjectHelper::ENVIRONMENT)
@target_project = @client.create_project_from_blueprint(@source_project.blueprint, token: ConnectionHelper::SECRETS[:gd_project_token], environment: ProjectHelper::ENVIRONMENT)
end
after(:all) do
@source_project && @source_project.delete
@target_project && @target_project.delete
@client && @client.disconnect
end
it 'should be able to transfer attribute drill paths' do
name_attribute_source = @source_project.attributes('attr.id.name')
id_attribute_source = @source_project.attributes('attr.id.id')
name_attribute_source.drill_down(id_attribute_source)
GoodData::LCM.transfer_attribute_drillpaths(@source_project, @target_project)
name_attribute_target = @target_project.attributes('attr.id.name')
id_attribute_target = @target_project.attributes('attr.id.id')
name_attribute_target.drill_down(id_attribute_target)
expect(@target_project.labels(name_attribute_target.content['drillDownStepAttributeDF']).attribute_uri).to eq id_attribute_target.meta['uri']
end
it 'should be able to transfer color palette' do
color_palettes = [
{
guid: 'hello',
fill: {
r: 155,
g: 255,
b: 0
}
}
]
@source_project.create_custom_color_palette(color_palettes)
GoodData::Project.transfer_color_palette(@source_project, @target_project)
expect(@target_project.current_color_palette.colors).to eq color_palettes.map { |color| GoodData::Helpers.stringify_keys(color) }
end
end