gooddata 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.document +0 -0
- data/.flayignore +2 -0
- data/.travis.yml +24 -7
- data/.yardopts +0 -0
- data/CHANGELOG.md +125 -1
- data/CLI.md +0 -0
- data/Dockerfile.jruby +7 -2
- data/Dockerfile.ruby +1 -1
- data/Gemfile +0 -0
- data/Guardfile +0 -0
- data/Rakefile +23 -9
- data/TODO.md +0 -0
- data/bin/gitflow-init.sh +8 -0
- data/ci.rake +3 -3
- data/data/2008.crt +39 -0
- data/data/new_ca.cer +22 -0
- data/dependency_decisions.yml +0 -0
- data/docker-compose.lcm.yml +31 -0
- data/docker-compose.yml +4 -2
- data/gooddata.gemspec +3 -3
- data/lcm.rake +288 -0
- data/lib/gooddata.rb +1 -0
- data/lib/gooddata/bricks/base_downloader.rb +1 -1
- data/lib/gooddata/bricks/brick.rb +0 -1
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +1 -1
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
- data/lib/gooddata/bricks/pipeline.rb +67 -0
- data/lib/gooddata/bricks/provisioning_brick.rb +18 -0
- data/lib/gooddata/bricks/release_brick.rb +18 -0
- data/lib/gooddata/bricks/rollout_brick.rb +14 -0
- data/lib/gooddata/bricks/user_filters_brick.rb +13 -0
- data/lib/gooddata/bricks/users_brick.rb +13 -0
- data/lib/gooddata/core/logging.rb +1 -1
- data/lib/gooddata/exceptions/maql_execution.rb +1 -1
- data/lib/gooddata/extensions/string.rb +0 -0
- data/lib/gooddata/lcm/actions/associate_clients.rb +34 -8
- data/lib/gooddata/lcm/actions/collect_data_product.rb +8 -1
- data/lib/gooddata/lcm/actions/collect_segment_clients.rb +13 -23
- data/lib/gooddata/lcm/actions/collect_segments.rb +10 -0
- data/lib/gooddata/lcm/actions/synchronize_clients.rb +3 -1
- data/lib/gooddata/lcm/actions/synchronize_ldm.rb +61 -34
- data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +6 -4
- data/lib/gooddata/lcm/actions/update_release_table.rb +4 -12
- data/lib/gooddata/lcm/dsl/params_dsl.rb +0 -4
- data/lib/gooddata/lcm/dsl/type_dsl.rb +0 -4
- data/lib/gooddata/lcm/helpers/check_helper.rb +1 -1
- data/lib/gooddata/lcm/lcm2.rb +0 -2
- data/lib/gooddata/lcm/types/special/enum.rb +6 -0
- data/lib/gooddata/lcm/types/special/enum/synchronize_ldm.rb +20 -0
- data/lib/gooddata/lcm/types/special/types.rb +1 -1
- data/lib/gooddata/mixins/is_folder.rb +0 -0
- data/lib/gooddata/mixins/to_json.rb +0 -0
- data/lib/gooddata/mixins/uri_getter.rb +0 -0
- data/lib/gooddata/models/project_creator.rb +38 -30
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -0
- data/lib/gooddata/rest/README.md +0 -0
- data/lib/gooddata/version.rb +1 -1
- data/lib/templates/bricks/brick.rb.erb +0 -0
- data/lib/templates/bricks/main.rb.erb +0 -0
- data/lib/templates/project/Goodfile.erb +0 -0
- data/lib/templates/project/data/commits.csv +0 -0
- data/lib/templates/project/data/devs.csv +0 -0
- data/lib/templates/project/data/repos.csv +0 -0
- data/lib/templates/project/model/model.rb.erb +0 -0
- metadata +21 -451
- data/lib/gooddata/lcm/actions/ensure_data_product.rb +0 -63
- data/spec/.rubocop.yml +0 -16
- data/spec/bricks/bricks_spec.rb +0 -110
- data/spec/bricks/default-config.json +0 -8
- data/spec/data/.gooddata +0 -4
- data/spec/data/blueprints/additional_dataset_module.json +0 -32
- data/spec/data/blueprints/attribute_sort_order_blueprint.json +0 -72
- data/spec/data/blueprints/big_blueprint_not_pruned.json +0 -2079
- data/spec/data/blueprints/invalid_blueprint.json +0 -103
- data/spec/data/blueprints/m_n_model.json +0 -104
- data/spec/data/blueprints/model_module.json +0 -25
- data/spec/data/blueprints/test_blueprint.json +0 -39
- data/spec/data/blueprints/test_project_model_spec.json +0 -106
- data/spec/data/cc/data/source/commits.csv +0 -4
- data/spec/data/cc/data/source/devs.csv +0 -4
- data/spec/data/cc/data/source/repos.csv +0 -3
- data/spec/data/cc/devel.prm +0 -0
- data/spec/data/cc/graph/graph.grf +0 -11
- data/spec/data/cc/workspace.prm +0 -19
- data/spec/data/column_based_permissions.csv +0 -7
- data/spec/data/column_based_permissions2.csv +0 -6
- data/spec/data/dynamic_schedule_params_table.csv +0 -7
- data/spec/data/gd_gse_data_blueprint.json +0 -1371
- data/spec/data/gd_gse_data_manifest.json +0 -1424
- data/spec/data/gd_gse_data_model.json +0 -1772
- data/spec/data/gooddata_version_process/gooddata_version.rb +0 -9
- data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
- data/spec/data/hello_world_process/hello_world.rb +0 -9
- data/spec/data/hello_world_process/hello_world.zip +0 -0
- data/spec/data/integration_model.json +0 -252
- data/spec/data/integration_policies.csv +0 -9134
- data/spec/data/line_based_permissions.csv +0 -3
- data/spec/data/manifests/test_blueprint.json +0 -32
- data/spec/data/manifests/test_project.json +0 -107
- data/spec/data/reports/left_attr_report.json +0 -108
- data/spec/data/reports/metric_only_one_line.json +0 -83
- data/spec/data/reports/report_1.json +0 -197
- data/spec/data/reports/top_attr_report.json +0 -108
- data/spec/data/ruby_params_process/ruby_params.rb +0 -9
- data/spec/data/ruby_process/deep_files/deep_stuff.txt +0 -1
- data/spec/data/ruby_process/process.rb +0 -8
- data/spec/data/ruby_process/stuff.txt +0 -1
- data/spec/data/superfluous_titles_view.json +0 -81
- data/spec/data/test-ci-data.csv +0 -2
- data/spec/data/user_filters.csv +0 -2
- data/spec/data/users.csv +0 -12
- data/spec/data/wire_models/attribute_sort_by_model.json +0 -73
- data/spec/data/wire_models/model_view.json +0 -1775
- data/spec/data/wire_models/nu_model.json +0 -3046
- data/spec/data/wire_models/test_blueprint.json +0 -66
- data/spec/data/wire_test_project.json +0 -150
- data/spec/data/workspace_table.csv +0 -3
- data/spec/environment/default.rb +0 -43
- data/spec/environment/development.rb +0 -32
- data/spec/environment/environment.rb +0 -38
- data/spec/environment/production.rb +0 -27
- data/spec/environment/staging.rb +0 -32
- data/spec/environment/testing.rb +0 -32
- data/spec/helpers/appstore_project_helper.rb +0 -221
- data/spec/helpers/blueprint_helper.rb +0 -27
- data/spec/helpers/cli_helper.rb +0 -38
- data/spec/helpers/connection_helper.rb +0 -43
- data/spec/helpers/constants.rb +0 -32
- data/spec/helpers/crypto_helper.rb +0 -19
- data/spec/helpers/csv_helper.rb +0 -20
- data/spec/helpers/process_helper.rb +0 -35
- data/spec/helpers/project_helper.rb +0 -74
- data/spec/helpers/schedule_helper.rb +0 -33
- data/spec/helpers/spec_helper.rb +0 -17
- data/spec/integration/ads_output_stage_spec.rb +0 -45
- data/spec/integration/blueprint_updates_spec.rb +0 -107
- data/spec/integration/blueprint_with_ca_spec.rb +0 -56
- data/spec/integration/blueprint_with_grain_spec.rb +0 -74
- data/spec/integration/channel_configuration_spec.rb +0 -67
- data/spec/integration/clients_spec.rb +0 -164
- data/spec/integration/command_datawarehouse_spec.rb +0 -45
- data/spec/integration/command_projects_spec.rb +0 -32
- data/spec/integration/commands/command_projects_spec.rb +0 -22
- data/spec/integration/connection_spec.rb +0 -37
- data/spec/integration/core/connection_spec.rb +0 -56
- data/spec/integration/core/logging_spec.rb +0 -132
- data/spec/integration/core/project_spec.rb +0 -54
- data/spec/integration/create_from_template_spec.rb +0 -29
- data/spec/integration/create_project_spec.rb +0 -27
- data/spec/integration/date_dim_switch_spec.rb +0 -154
- data/spec/integration/deprecated_load_spec.rb +0 -60
- data/spec/integration/full_process_schedule_spec.rb +0 -367
- data/spec/integration/full_project_spec.rb +0 -592
- data/spec/integration/helpers_spec.rb +0 -16
- data/spec/integration/lcm_spec.rb +0 -54
- data/spec/integration/mandatory_user_filter_spec.rb +0 -53
- data/spec/integration/mixins/id_to_uri_spec.rb +0 -56
- data/spec/integration/models/data_product_spec.rb +0 -71
- data/spec/integration/models/domain_spec.rb +0 -162
- data/spec/integration/models/invitation_spec.rb +0 -17
- data/spec/integration/models/label_spec.rb +0 -49
- data/spec/integration/models/membership_spec.rb +0 -127
- data/spec/integration/models/metadata/report_spec.rb +0 -54
- data/spec/integration/models/metric_spec.rb +0 -24
- data/spec/integration/models/params_spec.rb +0 -118
- data/spec/integration/models/process_spec.rb +0 -35
- data/spec/integration/models/profile_spec.rb +0 -210
- data/spec/integration/models/project_role_spec.rb +0 -94
- data/spec/integration/models/project_spec.rb +0 -225
- data/spec/integration/models/schedule_spec.rb +0 -477
- data/spec/integration/models/unit_project_spec.rb +0 -130
- data/spec/integration/over_to_user_filters_spec.rb +0 -98
- data/spec/integration/partial_md_export_import_spec.rb +0 -41
- data/spec/integration/project_spec.rb +0 -381
- data/spec/integration/rest_spec.rb +0 -214
- data/spec/integration/schedule_spec.rb +0 -611
- data/spec/integration/segments_spec.rb +0 -100
- data/spec/integration/subscription_spec.rb +0 -88
- data/spec/integration/urn_date_dim_spec.rb +0 -53
- data/spec/integration/user_filters_spec.rb +0 -310
- data/spec/integration/user_group_spec.rb +0 -147
- data/spec/integration/variables_spec.rb +0 -189
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/can_assign_a_custom_logger.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/client_logs_when_given_custom_message.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/has_the_request_id_logged_when_I_passed_it.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_off/Disables_logging.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_on/Enables_logging.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project/Returns_project_assigned.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_nil.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_directly.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_ID.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_URL.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_-_project/_with_project/Uses_project_specified.yml +0 -354
- data/spec/integration/vcr_cassettes/GoodData_Metric/all.yml +0 -2065
- data/spec/integration/vcr_cassettes/GoodData_Metric/should_be_able_to_update_folders.yml +0 -119
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/all.yml +0 -9812
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_get_json_containing_correct_id.yml +0 -174
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_return_nil_for_unknown_id.yml +0 -58
- data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_throw_BadRequest_for_-1.yml +0 -63
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_connect/Connects_using_username_and_password.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_disconnect/Connects_using_username_and_password.yml +0 -299
- data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_generate_request_id/Generates_a_non-empty_string.yml +0 -2287
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_/Should_list_user_groups_as_Array.yml +0 -56
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_add_members/Should_add_member.yml +0 -315
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_members/Should_return_members_as_array.yml +0 -54
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_remove_members/Should_remove_existing_members.yml +0 -258
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_save/updates_existing_group.yml +0 -159
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/_set_members/Should_set_new_members.yml +0 -158
- data/spec/integration/vcr_cassettes/GoodData_UserGroup/all.yml +0 -809
- data/spec/logging_in_logging_out_spec.rb +0 -91
- data/spec/spec_helper.rb +0 -110
- data/spec/unit/actions/associate_clients_spec.rb +0 -48
- data/spec/unit/actions/collect_client_projects_spec.rb +0 -47
- data/spec/unit/actions/collect_clients_spec.rb +0 -65
- data/spec/unit/actions/collect_data_product_spec.rb +0 -58
- data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +0 -56
- data/spec/unit/actions/collect_meta_spec.rb +0 -88
- data/spec/unit/actions/collect_segment_clients_spec.rb +0 -82
- data/spec/unit/actions/collect_tagged_objects_spec.rb +0 -126
- data/spec/unit/actions/collect_users_brick_users_spec.rb +0 -36
- data/spec/unit/actions/create_segment_masters_spec.rb +0 -65
- data/spec/unit/actions/ensure_data_product_spec.rb +0 -39
- data/spec/unit/actions/ensure_technical_users_domain_spec.rb +0 -53
- data/spec/unit/actions/ensure_technical_users_project_spec.rb +0 -76
- data/spec/unit/actions/execute_schedules_spec.rb +0 -94
- data/spec/unit/actions/provision_clients_spec.rb +0 -46
- data/spec/unit/actions/purge_clients_spec.rb +0 -47
- data/spec/unit/actions/rename_existing_client_projects_spec.rb +0 -54
- data/spec/unit/actions/segments_filter_spec.rb +0 -46
- data/spec/unit/actions/shared_examples_for_user_actions.rb +0 -43
- data/spec/unit/actions/synchronize_cas_spec.rb +0 -58
- data/spec/unit/actions/synchronize_clients_spec.rb +0 -71
- data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +0 -206
- data/spec/unit/actions/synchronize_ldm_spec.rb +0 -70
- data/spec/unit/actions/synchronize_user_filters_spec.rb +0 -208
- data/spec/unit/actions/synchronize_user_groups_spec.rb +0 -49
- data/spec/unit/actions/synchronize_users_spec.rb +0 -180
- data/spec/unit/bricks/bricks_spec.rb +0 -34
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +0 -98
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +0 -30
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +0 -15
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +0 -15
- data/spec/unit/cli/cli_spec.rb +0 -17
- data/spec/unit/cli/commands/cmd_auth_spec.rb +0 -17
- data/spec/unit/core/nil_logger_spec.rb +0 -13
- data/spec/unit/extensions/hash_spec.rb +0 -22
- data/spec/unit/godzilla/goodzilla_spec.rb +0 -74
- data/spec/unit/helpers/check_helper_production_spec.rb +0 -34
- data/spec/unit/helpers/check_helper_spec.rb +0 -134
- data/spec/unit/helpers/csv_helper_spec.rb +0 -22
- data/spec/unit/helpers/data_helper_spec.rb +0 -67
- data/spec/unit/helpers/global_helpers_spec.rb +0 -264
- data/spec/unit/helpers_spec.rb +0 -254
- data/spec/unit/lcm/lcm2_spec.rb +0 -100
- data/spec/unit/lcm/user_bricks_helper_spec.rb +0 -58
- data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +0 -20
- data/spec/unit/models/blueprint/attributes_spec.rb +0 -28
- data/spec/unit/models/blueprint/dataset_spec.rb +0 -120
- data/spec/unit/models/blueprint/label_blueprint_field_spec.rb +0 -43
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +0 -642
- data/spec/unit/models/blueprint/reference_spec.rb +0 -28
- data/spec/unit/models/blueprint/schema_builder_spec.rb +0 -36
- data/spec/unit/models/blueprint/to_wire_spec.rb +0 -196
- data/spec/unit/models/dataset_blueprint.rb +0 -14
- data/spec/unit/models/execution_spec.rb +0 -109
- data/spec/unit/models/from_wire_spec.rb +0 -321
- data/spec/unit/models/metadata_spec.rb +0 -140
- data/spec/unit/models/metric_spec.rb +0 -129
- data/spec/unit/models/model_spec.rb +0 -87
- data/spec/unit/models/project_creator_spec.rb +0 -90
- data/spec/unit/models/project_spec.rb +0 -94
- data/spec/unit/models/report_result_data_spec.rb +0 -194
- data/spec/unit/models/to_manifest_spec.rb +0 -165
- data/spec/unit/models/user_filters/user_filter_builder_spec.rb +0 -149
- data/spec/unit/models/user_filters_spec.rb +0 -95
- data/spec/unit/models/variable_spec.rb +0 -280
- data/spec/unit/rest/phmap_spec.rb +0 -117
- data/spec/unit/rest/polling_spec.rb +0 -101
- data/spec/unit/rest/resource_spec.rb +0 -10
- data/spec/vcr_configurer.rb +0 -63
@@ -1,194 +0,0 @@
|
|
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/report_data_result'
|
8
|
-
|
9
|
-
describe GoodData::ReportDataResult do
|
10
|
-
before(:each) do
|
11
|
-
data = JSON.parse(File.read('./spec/data/reports/report_1.json'))
|
12
|
-
@result = GoodData::ReportDataResult.from_xtab(data)
|
13
|
-
@result2 = GoodData::ReportDataResult.from_xtab(data)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'should compute columns' do
|
17
|
-
expect(@result.to_a).to eq [[nil, "kolin", "praha", "varsava"],
|
18
|
-
[nil, "sum of Age", "sum of Age", "sum of Age"],
|
19
|
-
["jirka", 25, nil, nil],
|
20
|
-
["petr", nil, nil, 15],
|
21
|
-
["tomas", nil, 25, nil]]
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should compute columns' do
|
25
|
-
expect(@result.left_headers).to eq [["jirka"],
|
26
|
-
["petr"],
|
27
|
-
["tomas"]]
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should compute columns' do
|
31
|
-
expect(@result.top_headers).to eq [%w(kolin praha varsava), ["sum of Age", "sum of Age", "sum of Age"]]
|
32
|
-
end
|
33
|
-
|
34
|
-
describe '#slice' do
|
35
|
-
it 'slice on zeroes should be equal to original' do
|
36
|
-
expect(@result.slice(0, 0)).to eq @result
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'slice on data should return just data' do
|
40
|
-
expect(@result.slice(2, 1).to_a).to eq [[25, nil, nil],
|
41
|
-
[nil, nil, 15],
|
42
|
-
[nil, 25, nil]]
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should return data result with correct size' do
|
46
|
-
expect(@result.slice(2, 1).size).to eq [3, 3]
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should return data result with correct headers' do
|
50
|
-
expect(@result.left_headers).to eq [["jirka"], ["petr"], ["tomas"]]
|
51
|
-
expect(@result.top_headers).to eq [%w(kolin praha varsava), ["sum of Age", "sum of Age", "sum of Age"]]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe '#without_left_headers' do
|
56
|
-
it 'should return data result without left headers' do
|
57
|
-
expect(@result.without_left_headers.to_a).to eq [%w(kolin praha varsava),
|
58
|
-
["sum of Age", "sum of Age", "sum of Age"],
|
59
|
-
[25, nil, nil],
|
60
|
-
[nil, nil, 15],
|
61
|
-
[nil, 25, nil]]
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'should return correct size' do
|
65
|
-
expect(@result.without_left_headers.size).to eq [5, 3]
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should return correct left headers' do
|
69
|
-
expect(@result.without_top_headers.top_headers).to eq nil
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe '#without_top_headers' do
|
74
|
-
it 'should return data result without left headers' do
|
75
|
-
expect(@result.without_top_headers.to_a).to eq [["jirka", 25, nil, nil],
|
76
|
-
["petr", nil, nil, 15],
|
77
|
-
["tomas", nil, 25, nil]]
|
78
|
-
end
|
79
|
-
|
80
|
-
it 'should return correct size' do
|
81
|
-
expect(@result.without_top_headers.size).to eq [3, 4]
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'should return correct left headers' do
|
85
|
-
expect(@result.without_top_headers.left_headers).to eq [["jirka"],
|
86
|
-
["petr"],
|
87
|
-
["tomas"]]
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'should return correct top headers' do
|
91
|
-
expect(@result.without_top_headers.top_headers).to eq nil
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should work with left attribute reports' do
|
96
|
-
data = JSON.parse(File.read('./spec/data/reports/left_attr_report.json'))
|
97
|
-
result = GoodData::ReportDataResult.from_xtab(data)
|
98
|
-
expect(result.left_headers).to eq [["jirka"], ["petr"], ["tomas"]]
|
99
|
-
expect(result.size).to eq [4, 2]
|
100
|
-
expect(result.data_size).to eq [3, 1]
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'should work with left attribute reports' do
|
104
|
-
data = JSON.parse(File.read('./spec/data/reports/top_attr_report.json'))
|
105
|
-
result = GoodData::ReportDataResult.from_xtab(data)
|
106
|
-
expect(result.size).to eq [2, 4]
|
107
|
-
expect(result.data_size).to eq [1, 3]
|
108
|
-
expect(result.left_headers).to eq [["Values"]]
|
109
|
-
expect(result.top_headers).to eq [%w(jirka petr tomas)]
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'should fail when comparing two different reports' do
|
113
|
-
data = JSON.parse(File.read('./spec/data/reports/left_attr_report.json'))
|
114
|
-
a = GoodData::ReportDataResult.from_xtab(data)
|
115
|
-
data = JSON.parse(File.read('./spec/data/reports/top_attr_report.json'))
|
116
|
-
b = GoodData::ReportDataResult.from_xtab(data)
|
117
|
-
expect(a == b).to be_falsey
|
118
|
-
end
|
119
|
-
|
120
|
-
describe '#size' do
|
121
|
-
it 'should compute columns' do
|
122
|
-
expect(@result.size).to eq [5, 4]
|
123
|
-
end
|
124
|
-
|
125
|
-
it 'should compute columns' do
|
126
|
-
expect(@result.size).to eq @result2.size
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe '#data' do
|
131
|
-
it 'should return just data portion' do
|
132
|
-
expect(@result.data.is_a?(GoodData::ReportDataResult)).to be_truthy
|
133
|
-
expect(@result.data.to_a).to eq [[25, nil, nil],
|
134
|
-
[nil, nil, 15],
|
135
|
-
[nil, 25, nil]]
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
describe '#[]' do
|
140
|
-
it 'should return correct line' do
|
141
|
-
expect(@result[2]).to eq ['jirka', 25, nil, nil]
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
describe '#column' do
|
146
|
-
it 'should return correct line' do
|
147
|
-
expect(@result.column(2)).to eq ["praha", "sum of Age", nil, nil, 25]
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
describe '#map' do
|
152
|
-
it 'should iterate over rows' do
|
153
|
-
expect(@result.each.map { [1] }).to eq [[1], [1], [1], [1], [1]]
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
describe '#transpose' do
|
158
|
-
it 'should transpose' do
|
159
|
-
expect(@result.transpose.to_a).to eq @result.to_a.transpose
|
160
|
-
expect(@result.transpose.to_a).to eq [[nil, nil, "jirka", "petr", "tomas"],
|
161
|
-
["kolin", "sum of Age", 25, nil, nil],
|
162
|
-
["praha", "sum of Age", nil, nil, 25],
|
163
|
-
["varsava", "sum of Age", nil, 15, nil]]
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
describe '#diff' do
|
168
|
-
it 'should support diffing' do
|
169
|
-
data = JSON.parse(File.read('./spec/data/reports/left_attr_report.json'))
|
170
|
-
a = GoodData::ReportDataResult.from_xtab(data)
|
171
|
-
c = GoodData::ReportDataResult.from_xtab(data)
|
172
|
-
data = JSON.parse(File.read('./spec/data/reports/top_attr_report.json'))
|
173
|
-
b = GoodData::ReportDataResult.from_xtab(data)
|
174
|
-
expect { a - b }.to raise_exception
|
175
|
-
expect(a - c).to be_empty
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
describe 'one line reports' do
|
180
|
-
it 'should work with one line metric. No attribtues.' do
|
181
|
-
data = JSON.parse(File.read('./spec/data/reports/metric_only_one_line.json'))
|
182
|
-
a = GoodData::ReportDataResult.from_xtab(data)
|
183
|
-
expect(a.to_a).to eq [[nil, "sum of Age"],
|
184
|
-
["sum of Age", 65]]
|
185
|
-
|
186
|
-
expect(a.data.to_a).to eq [[65]]
|
187
|
-
expect(a.left_headers).to eq [["sum of Age"]]
|
188
|
-
expect(a.top_headers).to eq [["sum of Age"]]
|
189
|
-
|
190
|
-
expect(a.without_top_headers.to_a).to eq [["sum of Age", 65]]
|
191
|
-
expect(a.without_left_headers.to_a).to eq [["sum of Age"], [65]]
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
@@ -1,165 +0,0 @@
|
|
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'
|
8
|
-
|
9
|
-
include GoodData::Model
|
10
|
-
|
11
|
-
describe GoodData::Model::ToManifest do
|
12
|
-
before(:each) do
|
13
|
-
@spec = JSON.parse(File.read("./spec/data/blueprints/test_project_model_spec.json"), :symbolize_names => true)
|
14
|
-
@result = JSON.parse(File.read("./spec/data/manifests/test_project.json"))
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should parse the model view and return the blueprint" do
|
18
|
-
expect(ToManifest.to_manifest(@spec)).to eq @result
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'when HLL fact is in the spec' do
|
22
|
-
let(:hll_fact) do
|
23
|
-
{
|
24
|
-
type: "hll",
|
25
|
-
id: 'fact.commits.lines_added',
|
26
|
-
column_name: 'lines_added',
|
27
|
-
title: 'Lines Added'
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:spec) do
|
32
|
-
hll_spec = @spec
|
33
|
-
hll_spec[:datasets]
|
34
|
-
.find { |d| d[:id] == 'dataset.commits' }[:columns] << hll_fact
|
35
|
-
hll_spec
|
36
|
-
end
|
37
|
-
|
38
|
-
it "converts the HLL fact to manifest" do
|
39
|
-
actual = ToManifest.to_manifest(spec)
|
40
|
-
expected = {
|
41
|
-
'populates' => ['fact.commits.lines_added'],
|
42
|
-
'mode' => 'FULL',
|
43
|
-
'columnName' => 'lines_added'
|
44
|
-
}
|
45
|
-
parts = actual[2]['dataSetSLIManifest']['parts']
|
46
|
-
expect(parts).to include(expected)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'blueprint can be set with date reference and default format is set' do
|
51
|
-
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
52
|
-
p.add_date_dimension("committed_on")
|
53
|
-
|
54
|
-
p.add_dataset("repos") do |d|
|
55
|
-
d.add_anchor("repo_id")
|
56
|
-
d.add_attribute("name")
|
57
|
-
d.add_date('opportunity_comitted', dataset: 'committed_on')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
expect(blueprint.to_manifest.first['dataSetSLIManifest']['parts'][0]['constraints']).to eq("date" => GoodData::Model::DEFAULT_DATE_FORMAT)
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'blueprint can be set with date reference and default format is set' do
|
64
|
-
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
65
|
-
p.add_date_dimension("committed_on")
|
66
|
-
|
67
|
-
p.add_dataset("repos") do |d|
|
68
|
-
d.add_anchor("repo_id")
|
69
|
-
d.add_attribute("name")
|
70
|
-
d.add_date('opportunity_comitted', dataset: 'committed_on', format: 'yyyy/MM/dd')
|
71
|
-
end
|
72
|
-
end
|
73
|
-
expect(blueprint.to_manifest.first['dataSetSLIManifest']['parts'][0]['constraints']).to eq("date" => "yyyy/MM/dd")
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'blueprint can handle date fact during creation of manifest' do
|
77
|
-
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
78
|
-
p.add_date_dimension("committed_on")
|
79
|
-
|
80
|
-
p.add_dataset("repos") do |d|
|
81
|
-
d.add_anchor("repo_id")
|
82
|
-
d.add_label("repo_label", reference: "repo_id")
|
83
|
-
d.add_attribute("name")
|
84
|
-
d.add_label("name_label", reference: "name")
|
85
|
-
d.add_date('opportunity_comitted', dataset: 'committed_on', format: 'yyyy/MM/dd')
|
86
|
-
d.add_column(type: :date_fact, id: 'dt.date_fact')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
expect(blueprint.to_manifest.first['dataSetSLIManifest']['parts'].count).to eq 4
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'blueprint can be specified to have a reference key. The manifest respects it. If not it takes the first key.' do
|
93
|
-
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
94
|
-
p.add_date_dimension("committed_on")
|
95
|
-
|
96
|
-
p.add_dataset("repos") do |d|
|
97
|
-
d.add_anchor("repo_id")
|
98
|
-
d.add_label("repo_label_1", reference: "repo_id")
|
99
|
-
d.add_label("repo_label_2", reference: "repo_id")
|
100
|
-
d.add_attribute("name")
|
101
|
-
d.add_label("name_label", reference: "name")
|
102
|
-
|
103
|
-
d.add_date('opportunity_comitted', dataset: 'committed_on', format: 'yyyy/MM/dd')
|
104
|
-
d.add_column(type: :date_fact, id: 'dt.date_fact')
|
105
|
-
end
|
106
|
-
end
|
107
|
-
expect(blueprint.to_manifest.first['dataSetSLIManifest']['parts'])
|
108
|
-
.to include("referenceKey" => 1,
|
109
|
-
"populates" => ["repo_label_1"],
|
110
|
-
"mode" => "FULL",
|
111
|
-
"columnName" => "repo_label_1")
|
112
|
-
|
113
|
-
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
114
|
-
p.add_date_dimension("committed_on")
|
115
|
-
|
116
|
-
p.add_dataset("repos") do |d|
|
117
|
-
d.add_anchor("repo_id")
|
118
|
-
d.add_label("repo_label_1", reference: "repo_id")
|
119
|
-
d.add_label("repo_label_2", reference: "repo_id", reference_label: true)
|
120
|
-
d.add_attribute("name")
|
121
|
-
d.add_label("name_label", reference: "name")
|
122
|
-
|
123
|
-
d.add_date('opportunity_comitted', dataset: 'committed_on', format: 'yyyy/MM/dd')
|
124
|
-
end
|
125
|
-
|
126
|
-
p.add_dataset("commits") do |d|
|
127
|
-
d.add_anchor("commits_id")
|
128
|
-
d.add_fact('lines')
|
129
|
-
d.add_reference('repos')
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
expect(blueprint.to_manifest.first['dataSetSLIManifest']['parts'])
|
134
|
-
.to include("referenceKey" => 1,
|
135
|
-
"populates" => ["repo_label_2"],
|
136
|
-
"mode" => "FULL",
|
137
|
-
"columnName" => "repo_label_2")
|
138
|
-
expect(blueprint.to_manifest[1]['dataSetSLIManifest']['parts']).to include("populates" => ["repo_label_2"], "mode" => "FULL", "columnName" => "repos", "referenceKey" => 1)
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'blueprint cannot have more than one reference key.' do
|
142
|
-
blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
|
143
|
-
p.add_date_dimension("committed_on")
|
144
|
-
|
145
|
-
p.add_dataset("repos") do |d|
|
146
|
-
d.add_anchor("repo_id")
|
147
|
-
d.add_label("repo_label_1", reference: "repo_id", reference_label: true)
|
148
|
-
d.add_label("repo_label_2", reference: "repo_id", reference_label: true)
|
149
|
-
d.add_attribute("name")
|
150
|
-
d.add_label("name_label", reference: "name")
|
151
|
-
|
152
|
-
d.add_date('opportunity_comitted', dataset: 'committed_on', format: 'yyyy/MM/dd')
|
153
|
-
d.add_column(type: :date_fact, id: 'dt.date_fact')
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
expect(blueprint.valid?).to be false
|
158
|
-
expect(blueprint.validate).to eq [
|
159
|
-
{
|
160
|
-
type: :error,
|
161
|
-
message: "Anchor \"repo_id\" can have only one label with reference_label field set to true"
|
162
|
-
}
|
163
|
-
]
|
164
|
-
end
|
165
|
-
end
|
@@ -1,149 +0,0 @@
|
|
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
|
-
shared_examples 'a user filter deleter' do
|
8
|
-
it 'deletes the filter' do
|
9
|
-
expect(existing_filter).to receive(:delete)
|
10
|
-
result = subject.execute_mufs(filter_definitions, options)
|
11
|
-
expect(result[:deleted].length).to be(1)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe GoodData::UserFilterBuilder do
|
16
|
-
describe '.execute_mufs' do
|
17
|
-
let(:login) { 'rubydev+admin@gooddata.com' }
|
18
|
-
let(:full_definition_filter) do
|
19
|
-
{
|
20
|
-
:login => login,
|
21
|
-
:filters => [{
|
22
|
-
:label => label_id,
|
23
|
-
:over => nil,
|
24
|
-
:to => nil,
|
25
|
-
:values => ["Washington"]
|
26
|
-
}]
|
27
|
-
}
|
28
|
-
end
|
29
|
-
|
30
|
-
let(:label_id) { 'label.csv_policies.state' }
|
31
|
-
let(:label_uri) { '/gdc/md/wock3futg594lz3ornqv70yvbsivf896/obj/270' }
|
32
|
-
let(:filter_definitions) { [full_definition_filter] }
|
33
|
-
let(:options) do
|
34
|
-
{ client: client, project: project }
|
35
|
-
end
|
36
|
-
let(:users_brick_input) { [{ 'login' => login }] }
|
37
|
-
let(:client) { double('client') }
|
38
|
-
let(:project) { double('project') }
|
39
|
-
let(:user) { double('user') }
|
40
|
-
let(:project_users) { [user] }
|
41
|
-
let(:label) { double('label') }
|
42
|
-
let(:filter) { double('filter') }
|
43
|
-
let(:existing_filter) { double('existing_filter') }
|
44
|
-
let(:profile_url) { '/gdc/account/profile/foo' }
|
45
|
-
|
46
|
-
before do
|
47
|
-
allow(project).to receive(:labels).with(label_uri)
|
48
|
-
.and_return(label)
|
49
|
-
allow(project).to receive(:labels).with("label.csv_policies.state")
|
50
|
-
.and_return(label)
|
51
|
-
allow(project).to receive(:attributes)
|
52
|
-
allow(project).to receive(:users).and_return(project_users)
|
53
|
-
allow(project).to receive(:data_permissions).and_return([existing_filter])
|
54
|
-
allow(project).to receive(:pid)
|
55
|
-
allow(label).to receive(:values_count).and_return(666_666)
|
56
|
-
allow(label).to receive(:uri).and_return(label_uri)
|
57
|
-
allow(label).to receive(:find_value_uri).with('Washington').and_return('foo')
|
58
|
-
allow(label).to receive(:attribute_uri).and_return('bar')
|
59
|
-
allow(label).to receive(:identifier).and_return(label_id)
|
60
|
-
allow(client).to receive(:create).and_return(filter)
|
61
|
-
allow(client).to receive(:get)
|
62
|
-
.and_return('userFilters' => { 'items' => [] })
|
63
|
-
allow(client).to receive(:post)
|
64
|
-
.and_return('userFiltersUpdateResult' => [])
|
65
|
-
allow(filter).to receive(:related_uri)
|
66
|
-
allow(existing_filter).to receive(:related_uri)
|
67
|
-
allow(filter).to receive(:save)
|
68
|
-
allow(filter).to receive(:uri)
|
69
|
-
allow(user).to receive(:login).and_return(login)
|
70
|
-
allow(user).to receive(:profile_url).and_return(login)
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'resolves mufs to be created/deleted' do
|
74
|
-
expect(existing_filter).to_not receive(:delete)
|
75
|
-
result = subject.execute_mufs(filter_definitions, options)
|
76
|
-
expect(result[:created].length).to be(1)
|
77
|
-
expect(result[:deleted].length).to be(0)
|
78
|
-
end
|
79
|
-
|
80
|
-
context 'when dry_run option set to true' do
|
81
|
-
let(:options) do
|
82
|
-
{ client: client,
|
83
|
-
project: project,
|
84
|
-
dry_run: true }
|
85
|
-
end
|
86
|
-
|
87
|
-
it 'does not alter filters' do
|
88
|
-
expect(client).not_to receive(:post)
|
89
|
-
subject.execute_mufs(filter_definitions, options)
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'returns results' do
|
93
|
-
result = subject.execute_mufs(filter_definitions, options)
|
94
|
-
expected = [{ status: 'dry_run', user: nil, type: 'create' }]
|
95
|
-
expect(result[:results]).to eq(expected)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context 'when users_brick_input option specified' do
|
100
|
-
let(:user) { double('user') }
|
101
|
-
let(:users_brick_input) { [{ 'login' => login }] }
|
102
|
-
let(:options) do
|
103
|
-
{ client: client,
|
104
|
-
project: project,
|
105
|
-
users_brick_input: users_brick_input }
|
106
|
-
end
|
107
|
-
before do
|
108
|
-
allow(project).to receive(:users).and_return([user])
|
109
|
-
allow(user).to receive(:login).and_return(login)
|
110
|
-
allow(user).to receive(:profile_url).and_return(profile_url)
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'when filter has user in users_brick_input' do
|
114
|
-
before do
|
115
|
-
allow(existing_filter).to receive(:json)
|
116
|
-
.and_return(related: profile_url)
|
117
|
-
end
|
118
|
-
it_behaves_like 'a user filter deleter'
|
119
|
-
context 'when users_brick_input has symbols as keys' do
|
120
|
-
let(:users_brick_input) { [{ login: login }] }
|
121
|
-
it_behaves_like 'a user filter deleter'
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
context 'when filter does not have user in users_brick_input' do
|
126
|
-
before do
|
127
|
-
allow(existing_filter).to receive(:json)
|
128
|
-
.and_return(related: 'not_in_users_brick_input')
|
129
|
-
end
|
130
|
-
|
131
|
-
it 'does not delete filter' do
|
132
|
-
result = subject.execute_mufs(filter_definitions, options)
|
133
|
-
expect(result[:deleted]).to be_empty
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
context 'when creating MUFs results in errors' do
|
139
|
-
before do
|
140
|
-
allow(client).to receive(:post)
|
141
|
-
.and_return 'userFiltersUpdateResult' => { 'failed' => [{ status: :failed }] }
|
142
|
-
end
|
143
|
-
|
144
|
-
it 'fails' do
|
145
|
-
expect { subject.execute_mufs(filter_definitions, options) }.to raise_error(/Creating MUFs resulted in errors/)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|