gooddata 0.6.53 → 0.6.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.flayignore +6 -0
- data/.gitignore +1 -0
- data/.pronto.yml +3 -0
- data/.rspec +2 -0
- data/.rubocop.yml +4 -1
- data/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +14 -1
- data/DEPENDENCIES.md +324 -253
- data/Dockerfile.jruby +5 -7
- data/Dockerfile.ruby +8 -8
- data/Rakefile +24 -0
- data/ci.rake +47 -0
- data/docker-compose.yml +34 -0
- data/gooddata.gemspec +8 -2
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +0 -3
- data/lib/gooddata/helpers/data_helper.rb +10 -7
- data/lib/gooddata/helpers/global_helpers_params.rb +8 -3
- data/lib/gooddata/lcm/actions/apply_custom_maql.rb +2 -1
- data/lib/gooddata/lcm/actions/associate_clients.rb +10 -1
- data/lib/gooddata/lcm/actions/collect_client_projects.rb +78 -0
- data/lib/gooddata/lcm/actions/collect_clients.rb +20 -6
- data/lib/gooddata/lcm/actions/collect_data_product.rb +62 -0
- data/lib/gooddata/lcm/actions/collect_dynamic_schedule_params.rb +62 -0
- data/lib/gooddata/lcm/actions/{collect_attrs.rb → collect_ldm_objects.rb} +3 -3
- data/lib/gooddata/lcm/actions/collect_meta.rb +6 -3
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +2 -1
- data/lib/gooddata/lcm/actions/collect_segments.rb +6 -7
- data/lib/gooddata/lcm/actions/collect_tagged_objects.rb +7 -4
- data/lib/gooddata/lcm/actions/create_segment_masters.rb +7 -3
- data/lib/gooddata/lcm/actions/ensure_data_product.rb +53 -0
- data/lib/gooddata/lcm/actions/ensure_technical_users_domain.rb +6 -2
- data/lib/gooddata/lcm/actions/ensure_technical_users_project.rb +30 -18
- data/lib/gooddata/lcm/actions/execute_schedules.rb +128 -0
- data/lib/gooddata/lcm/actions/provision_clients.rb +32 -21
- data/lib/gooddata/lcm/actions/purge_clients.rb +25 -39
- data/lib/gooddata/lcm/actions/rename_existing_client_projects.rb +70 -0
- data/lib/gooddata/lcm/actions/segments_filter.rb +6 -0
- data/lib/gooddata/lcm/actions/synchronize_cas.rb +11 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +2 -1
- data/lib/gooddata/lcm/actions/synchronize_etls_in_segment.rb +34 -15
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +10 -1
- data/lib/gooddata/lcm/actions/synchronize_new_segments.rb +2 -1
- data/lib/gooddata/lcm/actions/synchronize_processes.rb +4 -7
- data/lib/gooddata/lcm/actions/synchronize_tag_objects.rb +8 -5
- data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +224 -0
- data/lib/gooddata/lcm/actions/synchronize_user_groups.rb +53 -0
- data/lib/gooddata/lcm/actions/synchronize_users.rb +324 -0
- data/lib/gooddata/lcm/dsl/type_dsl.rb +1 -0
- data/lib/gooddata/lcm/helpers/check_helper.rb +4 -0
- data/lib/gooddata/lcm/helpers/tags_helper.rb +4 -3
- data/lib/gooddata/lcm/lcm2.rb +33 -1
- data/lib/gooddata/lcm/types/complex/segment.rb +3 -0
- data/lib/gooddata/lcm/types/complex/update_preference.rb +8 -2
- data/lib/gooddata/lcm/types/special/array.rb +1 -3
- data/lib/gooddata/lcm/types/special/enum.rb +1 -3
- data/lib/gooddata/mixins/md_id_to_uri.rb +0 -1
- data/lib/gooddata/mixins/md_json.rb +2 -2
- data/lib/gooddata/models/blueprint/project_blueprint.rb +15 -0
- data/lib/gooddata/models/blueprint/to_wire.rb +1 -0
- data/lib/gooddata/models/client.rb +21 -9
- data/lib/gooddata/models/data_product.rb +149 -0
- data/lib/gooddata/models/domain.rb +26 -72
- data/lib/gooddata/models/from_wire.rb +2 -0
- data/lib/gooddata/models/metadata/report.rb +9 -3
- data/lib/gooddata/models/metadata/report_definition.rb +2 -2
- data/lib/gooddata/models/model.rb +1 -1
- data/lib/gooddata/models/process.rb +4 -0
- data/lib/gooddata/models/project.rb +58 -35
- data/lib/gooddata/models/project_creator.rb +13 -0
- data/lib/gooddata/models/segment.rb +63 -16
- data/lib/gooddata/models/style_setting.rb +2 -15
- data/lib/gooddata/models/user_group.rb +2 -0
- data/lib/gooddata/rest/connection.rb +32 -9
- data/lib/gooddata/rest/object_factory.rb +0 -25
- data/lib/gooddata/version.rb +1 -1
- data/spec/data/blueprints/invalid_blueprint.json +2 -2
- data/spec/data/blueprints/test_project_model_spec.json +1 -1
- data/spec/data/dynamic_schedule_params_table.csv +7 -0
- data/spec/data/workspace_table.csv +3 -3
- data/spec/environment/staging.rb +3 -3
- data/spec/integration/ads_output_stage_spec.rb +0 -10
- data/spec/integration/clients_spec.rb +1 -1
- data/spec/{unit → integration}/commands/command_projects_spec.rb +0 -0
- data/spec/{unit → integration}/core/connection_spec.rb +0 -0
- data/spec/{unit → integration}/core/logging_spec.rb +0 -0
- data/spec/{unit → integration}/core/project_spec.rb +0 -0
- data/spec/integration/date_dim_switch_spec.rb +13 -0
- data/spec/integration/full_process_schedule_spec.rb +2 -2
- data/spec/integration/helpers_spec.rb +16 -0
- data/spec/integration/lcm_spec.rb +12 -2
- data/spec/integration/mixins/id_to_uri_spec.rb +44 -0
- data/spec/integration/models/data_product_spec.rb +71 -0
- data/spec/{unit → integration}/models/domain_spec.rb +2 -2
- data/spec/{unit → integration}/models/invitation_spec.rb +0 -0
- data/spec/{unit → integration}/models/membership_spec.rb +0 -0
- data/spec/{unit → integration}/models/params_spec.rb +0 -0
- data/spec/{unit → integration}/models/profile_spec.rb +0 -0
- data/spec/{unit → integration}/models/project_role_spec.rb +0 -0
- data/spec/integration/models/project_spec.rb +225 -0
- data/spec/{unit → integration}/models/schedule_spec.rb +0 -0
- data/spec/{unit → integration}/models/unit_project_spec.rb +0 -0
- data/spec/integration/project_spec.rb +40 -5
- data/spec/integration/segments_spec.rb +27 -26
- data/spec/integration/user_filters_spec.rb +1 -1
- data/spec/spec_helper.rb +15 -19
- data/spec/unit/actions/associate_clients_spec.rb +47 -0
- data/spec/unit/actions/collect_client_projects_spec.rb +47 -0
- data/spec/unit/actions/collect_clients_spec.rb +27 -0
- data/spec/unit/actions/collect_data_product_spec.rb +64 -0
- data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +56 -0
- data/spec/unit/actions/collect_meta_spec.rb +4 -4
- data/spec/unit/actions/collect_segment_clients_spec.rb +44 -3
- data/spec/unit/actions/collect_tagged_objects_spec.rb +20 -4
- data/spec/unit/actions/create_segment_masters_spec.rb +64 -0
- data/spec/unit/actions/ensure_data_product_spec.rb +38 -0
- data/spec/unit/actions/ensure_technical_users_domain_spec.rb +51 -0
- data/spec/unit/actions/ensure_technical_users_project_spec.rb +72 -0
- data/spec/unit/actions/execute_schedules_spec.rb +94 -0
- data/spec/unit/actions/provision_clients_spec.rb +45 -0
- data/spec/unit/actions/purge_clients_spec.rb +47 -0
- data/spec/unit/actions/rename_existing_client_projects_spec.rb +54 -0
- data/spec/unit/actions/segments_filter_spec.rb +46 -0
- data/spec/unit/actions/shared_examples_for_user_actions.rb +10 -0
- data/spec/unit/actions/synchronize_cas_spec.rb +58 -0
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +174 -13
- data/spec/unit/actions/synchronize_ldm_spec.rb +57 -0
- data/spec/unit/actions/synchronize_user_filters_spec.rb +142 -0
- data/spec/unit/actions/synchronize_user_groups_spec.rb +49 -0
- data/spec/unit/actions/synchronize_users_spec.rb +76 -0
- data/spec/unit/helpers/data_helper_spec.rb +17 -0
- data/spec/unit/helpers/global_helpers_spec.rb +16 -0
- data/spec/unit/helpers_spec.rb +0 -6
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +21 -4
- data/spec/unit/models/project_creator_spec.rb +16 -0
- data/spec/unit/models/project_spec.rb +66 -197
- metadata +202 -100
- data/PULL_REQUEST_TEMPLATE.md +0 -5
- data/lib/gooddata/bricks/middleware/params_inspect_middleware.rb +0 -21
@@ -35,14 +35,7 @@ module GoodData
|
|
35
35
|
end
|
36
36
|
uri = STYLE_SETTING_PATH % project.pid
|
37
37
|
data_to_send = GoodData::Helpers.deep_dup(EMPTY_OBJECT).tap do |d|
|
38
|
-
d['styleSettings']['chartPalette'] = colors
|
39
|
-
.each_with_index
|
40
|
-
.map do |color, index|
|
41
|
-
{
|
42
|
-
'guid' => "guid#{index + 1}",
|
43
|
-
'fill' => GoodData::Helpers.stringify_keys(color)
|
44
|
-
}
|
45
|
-
end
|
38
|
+
d['styleSettings']['chartPalette'] = colors.map { |color| GoodData::Helpers.stringify_keys(color) }
|
46
39
|
end
|
47
40
|
style = client.create(StyleSetting, data_to_send)
|
48
41
|
client.put(uri, data_to_send)
|
@@ -59,13 +52,7 @@ module GoodData
|
|
59
52
|
def initialize(json)
|
60
53
|
super
|
61
54
|
@json = json
|
62
|
-
@colors =
|
63
|
-
{
|
64
|
-
r: color['fill']['r'],
|
65
|
-
g: color['fill']['g'],
|
66
|
-
b: color['fill']['b']
|
67
|
-
}
|
68
|
-
end
|
55
|
+
@colors = json ? data['chartPalette'] : []
|
69
56
|
end
|
70
57
|
|
71
58
|
def empty?
|
@@ -505,7 +505,13 @@ module GoodData
|
|
505
505
|
:verify_ssl => verify_ssl,
|
506
506
|
:headers => @webdav_headers.merge(:x_gdc_authtt => headers[:x_gdc_authtt]),
|
507
507
|
:payload => File.new(filename, 'rb'))
|
508
|
-
|
508
|
+
|
509
|
+
begin
|
510
|
+
request.execute
|
511
|
+
rescue => e
|
512
|
+
GoodData.logger.error("Error when uploading file #{filename}", e)
|
513
|
+
raise e
|
514
|
+
end
|
509
515
|
end
|
510
516
|
|
511
517
|
def format_error(e, params = {})
|
@@ -575,7 +581,6 @@ ERR
|
|
575
581
|
merge_headers! response.headers
|
576
582
|
content_type = response.headers[:content_type]
|
577
583
|
return response if process == false
|
578
|
-
|
579
584
|
if content_type == 'application/json' || content_type == 'application/json;charset=UTF-8'
|
580
585
|
result = response.to_str == '""' ? {} : MultiJson.load(response.to_str)
|
581
586
|
GoodData.rest_logger.debug "Request ID: #{response.headers[:x_gdc_request]} - Response: #{result.inspect}"
|
@@ -591,6 +596,10 @@ ERR
|
|
591
596
|
elsif response.code == 204
|
592
597
|
result = nil
|
593
598
|
GoodData.rest_logger.debug 'Response: 204 no content'
|
599
|
+
elsif response.code == 200 && content_type.nil? && response.body.empty?
|
600
|
+
result = nil
|
601
|
+
# TMA-696
|
602
|
+
GoodData.rest_logger.warn 'Got response status 200 but no content-type and body.'
|
594
603
|
else
|
595
604
|
fail "Unsupported response content type '%s':\n%s" % [content_type, response.to_str[0..127]]
|
596
605
|
end
|
@@ -633,21 +642,35 @@ ERR
|
|
633
642
|
['/gdc/account/domains/{id}/users?login={login}', %r{/gdc/account/domains/[\w\d-]+/users\?login=[^&$]+}],
|
634
643
|
['/gdc/account/domains/{id}', %r{/gdc/account/domains/[\w\d-]+}],
|
635
644
|
|
636
|
-
['/gdc/
|
645
|
+
['/gdc/projects/{id}/execute', %r{/gdc/projects/[\w]+/execute}],
|
637
646
|
|
638
647
|
['/gdc/datawarehouse/instances/{id}', %r{/gdc/datawarehouse/instances/[\w]+}],
|
639
648
|
['/gdc/datawarehouse/executions/{id}', %r{/gdc/datawarehouse/executions/[\w]+}],
|
640
649
|
|
641
650
|
['/gdc/domains/{id}/segments/{segment}/synchronizeClients/results/{result}/details?offset={offset}&limit={limit}',
|
642
|
-
%r{/gdc/domains/[\w]+/segments/[\w-]+/synchronizeClients/results/[\w]+/details/\?offset=[\d]+&limit=[\d]+}],
|
643
|
-
['/gdc/domains/{id}/segments/{segment}/synchronizeClients/results/{result}',
|
644
|
-
|
645
|
-
['/gdc/domains/{id}/segments/{segment}', %r{/gdc/domains/[\w]+/segments/[\w-]
|
646
|
-
['/gdc/domains/{id}/
|
647
|
-
['/gdc/domains/{id}/', %r{/gdc/domains/[\w]+/}],
|
651
|
+
%r{/gdc/domains/[\w-]+/segments/[\w-]+/synchronizeClients/results/[\w]+/details/\?offset=[\d]+&limit=[\d]+}],
|
652
|
+
['/gdc/domains/{id}/segments/{segment}/synchronizeClients/results/{result}',
|
653
|
+
%r{/gdc/domains/[\w-]+/segments/[\w-]+/synchronizeClients/results/[\w]+}],
|
654
|
+
['/gdc/domains/{id}/segments/{segment}/', %r{/gdc/domains/[\w-]+/segments/[\w-]+/}],
|
655
|
+
['/gdc/domains/{id}/segments/{segment}', %r{/gdc/domains/[\w-]+/segments/[\w-]+}],
|
656
|
+
['/gdc/domains/{id}/clients?segment={segment}', %r{/gdc/domains/[\w-]+/clients\?segment=[\w-]+}],
|
657
|
+
['/gdc/domains/{id}/clients/{client_id}/settings/lcm.title', %r{/gdc/domains/[\w-]+/clients/[\w-]+/settings/lcm.title}],
|
658
|
+
['/gdc/domains/{id}/clients/{client_id}/settings/lcm.token', %r{/gdc/domains/[\w-]+/clients/[\w-]+/settings/lcm.token}],
|
659
|
+
['/gdc/domains/{id}/clients/{client_id}', %r{/gdc/domains/[\w-]+/clients/[\w-]+}],
|
660
|
+
['/gdc/domains/{id}/provisionClientProjects/results/{result}/details?offset={offset}&limit={limit}',
|
661
|
+
%r{/gdc/domains/[\w-]+/provisionClientProjects/results/[\w]+/details/\?offset=[\d]+&limit=[\d]+}],
|
662
|
+
['/gdc/domains/{id}/provisionClientProjects/results/{result}', %r{/gdc/domains/[\w-]+/provisionClientProjects/results/[\w]+}],
|
663
|
+
['/gdc/domains/{id}/provisionClientProjects', %r{/gdc/domains/[\w-]+/provisionClientProjects}],
|
664
|
+
['/gdc/domains/{id}/updateClients', %r{/gdc/domains/[\w-]+/updateClients}],
|
665
|
+
['/gdc/domains/{id}/', %r{/gdc/domains/[\w-]+/}],
|
648
666
|
|
649
667
|
['/gdc/exporter/result/{id}/{id}', %r{/gdc/exporter/result/[\w]+/[\w]+}],
|
650
668
|
|
669
|
+
['/gdc/internal/lcm/domains/{id}/dataproducts/{data_product}/segments/{segment}/syncProcesses/{process}',
|
670
|
+
%r{/gdc/internal/lcm/domains/[\w-]+/dataproducts/[\w-]+/segments/[\w-]+/syncProcesses/[\w]+}],
|
671
|
+
['/gdc/internal/lcm/domains/{id}/dataproducts/{data_product}/segments/{segment}/syncProcesses',
|
672
|
+
%r{/gdc/internal/lcm/domains/[\w-]+/dataproducts/[\w-]+/segments/[\w-]+/syncProcesses}],
|
673
|
+
|
651
674
|
['/gdc/internal/projects/{id}/objects/setPermissions', %r{/gdc/internal/projects/[\w]+/objects/setPermissions}],
|
652
675
|
|
653
676
|
['/gdc/md/{id}/variables/item/{id}', %r{/gdc/md/[\w]+/variables/item/[\d]+}],
|
@@ -18,25 +18,6 @@ module GoodData
|
|
18
18
|
attr_accessor :objects
|
19
19
|
attr_accessor :resources
|
20
20
|
|
21
|
-
#################################
|
22
|
-
# Class methods
|
23
|
-
#################################
|
24
|
-
class << self
|
25
|
-
# Gets list of all GoodData::Rest::Object subclasses
|
26
|
-
#
|
27
|
-
# @return [Array<GoodData::Rest::Object>] Subclasses of GoodData::Rest::Object
|
28
|
-
def objects
|
29
|
-
ObjectSpace.each_object(Class).select { |klass| klass < GoodData::Rest::Object }
|
30
|
-
end
|
31
|
-
|
32
|
-
# Gets list of all GoodData::Rest::Resource subclasses
|
33
|
-
#
|
34
|
-
# @return [Array<GoodData::Rest::Resource>] Subclasses of GoodData::Rest::Resource
|
35
|
-
def resources
|
36
|
-
ObjectSpace.each_object(Class).select { |klass| klass < GoodData::Rest::Resource }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
21
|
# Initializes instance of factory
|
41
22
|
#
|
42
23
|
# @param connection [GoodData::Rest::Connection] Connection used by factory
|
@@ -48,12 +29,6 @@ module GoodData
|
|
48
29
|
|
49
30
|
# Set connection used by factory
|
50
31
|
@connection = @client.connection
|
51
|
-
|
52
|
-
# Initialize internal factory map of GoodData::Rest::Object instances
|
53
|
-
@objects = ObjectFactory.objects
|
54
|
-
|
55
|
-
# Initialize internal factory map of GoodData::Rest::Resource instances
|
56
|
-
@resources = ObjectFactory.resources
|
57
32
|
end
|
58
33
|
|
59
34
|
def create(type, data = {}, opts = {})
|
data/lib/gooddata/version.rb
CHANGED
@@ -22,11 +22,11 @@
|
|
22
22
|
},
|
23
23
|
{
|
24
24
|
"type": "attribute",
|
25
|
-
"id" : "some_attr_id"
|
25
|
+
"id" : "some_attr_id(hello)"
|
26
26
|
},
|
27
27
|
{
|
28
28
|
"type": "label",
|
29
|
-
"id" : "
|
29
|
+
"id" : "some_label_id",
|
30
30
|
"reference": "some_attr_id",
|
31
31
|
"name": "email",
|
32
32
|
"gd_data_type": "VARCHAR(128)",
|
@@ -1,3 +1,3 @@
|
|
1
|
-
client_id,segment_id,project_title
|
2
|
-
client_foo,segment_foo,project_foo
|
3
|
-
client_bar,segment_bar,project_bar
|
1
|
+
client_id,segment_id,project_title,project_id
|
2
|
+
client_foo,segment_foo,project_foo,123456
|
3
|
+
client_bar,segment_bar,project_bar,
|
data/spec/environment/staging.rb
CHANGED
@@ -7,15 +7,15 @@
|
|
7
7
|
module GoodData
|
8
8
|
module Environment
|
9
9
|
module ConnectionHelper
|
10
|
-
encrypted_token =
|
11
|
-
|
10
|
+
encrypted_token = "YC+foKO2M8rIfB5gxF/sVvop5dRA7d/zLO/zzUlBr9ZimnoYe" \
|
11
|
+
"LFyAqU20U4k\ncRYb\n"
|
12
12
|
key = ENV['GD_SPEC_PASSWORD'] || ENV['BIA_ENCRYPTION_KEY']
|
13
13
|
token = GoodData::Helpers.decrypt(encrypted_token, key)
|
14
14
|
set_const :GD_PROJECT_TOKEN, token
|
15
15
|
set_const :DEFAULT_DOMAIN, 'staging-lcm-prod'
|
16
16
|
set_const :DEFAULT_SERVER, 'https://staging-lcm-prod.intgdc.com'
|
17
17
|
set_const :DEFAULT_USER_URL, '/gdc/account/profile/e306b64fb4178785c9cf29c29b5e498a'
|
18
|
-
set_const :STAGING_URI, 'https://
|
18
|
+
set_const :STAGING_URI, 'https://staging-lcm-prod.intgdc.com/gdc/uploads/'
|
19
19
|
end
|
20
20
|
|
21
21
|
module ProcessHelper
|
@@ -9,16 +9,6 @@ require 'gooddata'
|
|
9
9
|
describe GoodData::AdsOutputStage, :constraint => 'slow' do
|
10
10
|
before(:all) do
|
11
11
|
@client = ConnectionHelper.create_default_connection
|
12
|
-
|
13
|
-
# try to delete all posible ads
|
14
|
-
GoodData::DataWarehouse.all.map do |ads|
|
15
|
-
begin
|
16
|
-
ads.delete
|
17
|
-
rescue => e
|
18
|
-
puts "Cannot delete ads #{ads.id}. Reason: #{e.message}"
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
12
|
@ads = GoodData::DataWarehouse.create(client: @client, title: 'Test ADS', auth_token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
|
23
13
|
@project = @client.create_project(title: 'Test project', auth_token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
|
24
14
|
end
|
@@ -38,7 +38,7 @@ describe GoodData::Client do
|
|
38
38
|
it 'Returns specific tenant when schedule ID passed' do
|
39
39
|
client = @segment.clients(@segment_client)
|
40
40
|
expect(client).to be_an_instance_of(GoodData::Client)
|
41
|
-
expect(client.
|
41
|
+
expect(client.client_id).to eq @segment_client.client_id
|
42
42
|
end
|
43
43
|
|
44
44
|
after(:all) do
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -40,6 +40,19 @@ describe "Swapping a date dimension and exchanging all attributes/elements", :co
|
|
40
40
|
@client.disconnect
|
41
41
|
end
|
42
42
|
|
43
|
+
it 'should not get error when execute report with timestamp' do
|
44
|
+
metric = @project.attributes('created_on.date').create_metric(title: 'test_metric')
|
45
|
+
metric.save
|
46
|
+
|
47
|
+
report = @project.create_report(
|
48
|
+
left: metric,
|
49
|
+
top: ['created_on.quarter'],
|
50
|
+
filters: [['created_on.year', 2015, 2016]],
|
51
|
+
title: 'test_report'
|
52
|
+
)
|
53
|
+
report.execute(time: Time.now)
|
54
|
+
end
|
55
|
+
|
43
56
|
it "should swap the dimension, exchange all stuffs and not break anything" do
|
44
57
|
# WE have 2 date dims
|
45
58
|
expect(@blueprint.date_dimensions.map(&:id)).to eq %w(created_on created_on_2)
|
@@ -272,10 +272,10 @@ describe "Full process and schedule exercise", :constraint => 'slow' do
|
|
272
272
|
|
273
273
|
it 'should be able to deploy from app_store' do
|
274
274
|
begin
|
275
|
-
process = @project.deploy_process('
|
275
|
+
process = @project.deploy_process('${PRODUCTION_APPSTORE}:branch/master:/apps/hello_world_brick', name: 'hello_world_brick')
|
276
276
|
expect(process.class).to eq GoodData::Process
|
277
277
|
ensure
|
278
|
-
process.delete
|
278
|
+
process.delete if process
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
6
|
+
|
7
|
+
require 'gooddata/client'
|
8
|
+
require 'gooddata/models/model'
|
9
|
+
|
10
|
+
describe GoodData::Helpers do
|
11
|
+
describe '#find_goodfile' do
|
12
|
+
it 'works' do
|
13
|
+
GoodData::Helpers.find_goodfile.should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -37,8 +37,18 @@ describe GoodData::LCM, :constraint => 'slow' do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it 'should be able to transfer color palette' do
|
40
|
-
|
40
|
+
color_palettes = [
|
41
|
+
{
|
42
|
+
guid: 'hello',
|
43
|
+
fill: {
|
44
|
+
r: 155,
|
45
|
+
g: 255,
|
46
|
+
b: 0
|
47
|
+
}
|
48
|
+
}
|
49
|
+
]
|
50
|
+
@source_project.create_custom_color_palette(color_palettes)
|
41
51
|
GoodData::Project.transfer_color_palette(@source_project, @target_project)
|
42
|
-
expect(@target_project.current_color_palette.colors).to eq
|
52
|
+
expect(@target_project.current_color_palette.colors).to eq color_palettes.map { |color| GoodData::Helpers.stringify_keys(color) }
|
43
53
|
end
|
44
54
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
6
|
+
|
7
|
+
require 'gooddata/mixins/md_id_to_uri'
|
8
|
+
|
9
|
+
describe GoodData::Mixin::MdIdToUri do
|
10
|
+
before :each do
|
11
|
+
@client = ConnectionHelper.create_default_connection
|
12
|
+
project = ProjectHelper.get_default_project(client: @client)
|
13
|
+
|
14
|
+
class SomeTestClass
|
15
|
+
extend GoodData::Mixin::MdIdToUri
|
16
|
+
end
|
17
|
+
|
18
|
+
@opts = { client: @client, project: project }
|
19
|
+
end
|
20
|
+
|
21
|
+
after(:each) do
|
22
|
+
@client.disconnect
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should throw BadRequest for -1' do
|
26
|
+
expect do
|
27
|
+
SomeTestClass.identifier_to_uri(@opts, '-1')
|
28
|
+
end.to raise_error(RestClient::BadRequest) { |error|
|
29
|
+
error.response.should match(/does not match with value '-1'/)
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should return nil for unknown id' do
|
34
|
+
expect(SomeTestClass.identifier_to_uri(@opts, '0')).to be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should get json containing correct id' do
|
38
|
+
facts = GoodData::Fact.all(@opts)
|
39
|
+
fact = facts.to_a.first
|
40
|
+
uri = SomeTestClass.identifier_to_uri(@opts, fact.identifier)
|
41
|
+
res = @client.get(uri)
|
42
|
+
expect(res['fact']['meta']['identifier']).to eq fact.identifier
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
4
|
+
# This source code is licensed under the BSD-style license found in the
|
5
|
+
# LICENSE file in the root directory of this source tree.
|
6
|
+
|
7
|
+
require 'gooddata/models/segment'
|
8
|
+
require 'securerandom'
|
9
|
+
|
10
|
+
describe GoodData::DataProduct do
|
11
|
+
before(:all) do
|
12
|
+
@client = ConnectionHelper.create_default_connection
|
13
|
+
@domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
|
14
|
+
end
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
@uuid = SecureRandom.uuid
|
18
|
+
@data_product_id = "data-product-#{@uuid}"
|
19
|
+
@data_product = @domain.create_data_product(id: @data_product_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
after(:each) do
|
23
|
+
@data_product && @data_product.delete(force: true)
|
24
|
+
end
|
25
|
+
|
26
|
+
after(:all) do
|
27
|
+
@client.disconnect
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#[]' do
|
31
|
+
it 'Returns all data products when :all passed' do
|
32
|
+
res = @domain.data_products
|
33
|
+
expect(res).to be_an_instance_of(Array)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'Returns specific data product when data product ID passed' do
|
37
|
+
data_product = @domain.data_products(@data_product_id)
|
38
|
+
expect(data_product.uri).to eq @data_product.uri
|
39
|
+
expect(data_product).to be_an_instance_of(GoodData::DataProduct)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#delete' do
|
44
|
+
it 'Deletes particular data product' do
|
45
|
+
old_count = @domain.data_products.count
|
46
|
+
@data_product.delete
|
47
|
+
expect(@domain.data_products.length).to eq(old_count - 1)
|
48
|
+
# prevent delete attempt in the after hook
|
49
|
+
@data_product = nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#save' do
|
54
|
+
it 'can update a data product id' do
|
55
|
+
@data_product.data_product_id = 'different_id'
|
56
|
+
@data_product.save
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#create_segment' do
|
61
|
+
before do
|
62
|
+
@master_project = @client.create_project(title: "Test MASTER project for #{@uuid}", auth_token: ConnectionHelper::GD_PROJECT_TOKEN)
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'creates a segment' do
|
66
|
+
segment = @data_product.create_segment(segment_id: "test-segment-#{@uuid}", master_project: @master_project)
|
67
|
+
expect(segment).to be_instance_of GoodData::Segment
|
68
|
+
expect(segment.data_product.data_product_id).to eq(@data_product_id)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|