gooddata 1.1.0-java → 1.2.0-java
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 +144 -0
- 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 +23 -452
- 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,130 +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
|
-
describe GoodData::Project do
|
10
|
-
before(:all) do
|
11
|
-
@client = ConnectionHelper.create_default_connection
|
12
|
-
@p = GoodData::Project.create_object(title: 'a', client: @client)
|
13
|
-
@domain = @client.domain('dummy_domain')
|
14
|
-
@roles = [
|
15
|
-
GoodData::ProjectRole.create_object(title: 'Test Role',
|
16
|
-
summary: 'Test role summary',
|
17
|
-
identifier: 'test_role',
|
18
|
-
uri: '/roles/1',
|
19
|
-
permissions: {
|
20
|
-
"canManageFact" => "1",
|
21
|
-
"canListInvitationsInProject" => "1"
|
22
|
-
}),
|
23
|
-
GoodData::ProjectRole.create_object(title: 'Test Role 2',
|
24
|
-
summary: 'Test role 2 summary',
|
25
|
-
identifier: 'test_role_2',
|
26
|
-
uri: '/roles/2',
|
27
|
-
permissions: {
|
28
|
-
"canManageFact" => "1"
|
29
|
-
})
|
30
|
-
]
|
31
|
-
@domain_members = [
|
32
|
-
GoodData::Profile.create_object(login: 'john.doe+in_domain@gooddata.com', uri: '/uri/john_domain')
|
33
|
-
]
|
34
|
-
@members = [
|
35
|
-
GoodData::Membership.create(login: 'john.doe@goodadta.com', uri: '/uri/john'),
|
36
|
-
GoodData::Membership.create(login: 'jane.doe@goodadta.com', uri: '/uri/jane')
|
37
|
-
]
|
38
|
-
end
|
39
|
-
|
40
|
-
describe 'resolve_roles' do
|
41
|
-
it 'Can handle case with user login when user is in the project' do
|
42
|
-
# we have to provide users from project to be able to do this by login
|
43
|
-
a, b = @p.resolve_roles('john.doe@goodadta.com', 'test_role', project_users: @members, roles: @roles)
|
44
|
-
expect(a).to eq "/gdc/account/profile/john.doe@goodadta.com"
|
45
|
-
expect(b).to eq ["/roles/1"]
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'Can handle case with user uri when user is in the project' do
|
49
|
-
# we have to provide users from project to be able to do this by login
|
50
|
-
a, b = @p.resolve_roles('/uri/john', 'test_role', project_users: @members, roles: @roles)
|
51
|
-
expect(a).to eq "/uri/john"
|
52
|
-
expect(b).to eq ["/roles/1"]
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'can handle case with info with uri when user is in the project' do
|
56
|
-
# we have to provide users from project to be able to do this by login
|
57
|
-
a, b = @p.resolve_roles({ uri: '/uri/john', first_name: 'John' }, 'test_role', project_users: @members, roles: @roles)
|
58
|
-
expect(a).to eq "/uri/john"
|
59
|
-
expect(b).to eq ["/roles/1"]
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'can handle case with info with login when he is in the project' do
|
63
|
-
# we have to provide users from project to be able to do this by login
|
64
|
-
a, b = @p.resolve_roles({ login: 'john.doe@goodadta.com', first_name: 'John' }, 'test_role', project_users: @members, roles: @roles)
|
65
|
-
expect(a).to eq "/gdc/account/profile/john.doe@goodadta.com"
|
66
|
-
expect(b).to eq ["/roles/1"]
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'can handle case with member when he is in the project' do
|
70
|
-
# we have to provide users from project to be able to do this by login
|
71
|
-
a, b = @p.resolve_roles(@members.first, 'test_role_2', project_users: @members, roles: @roles)
|
72
|
-
expect(a).to eq "/uri/john"
|
73
|
-
expect(b).to eq ["/roles/2"]
|
74
|
-
end
|
75
|
-
|
76
|
-
it 'can handle case with profile when the user is in the project' do
|
77
|
-
# we have to provide users from project to be able to do this by login
|
78
|
-
a, b = @p.resolve_roles(@domain_members.first, 'test_role_2', project_users: @members, roles: @roles)
|
79
|
-
expect(a).to eq "/uri/john_domain"
|
80
|
-
expect(b).to eq ["/roles/2"]
|
81
|
-
end
|
82
|
-
|
83
|
-
it 'Can handle case with user login when user is in the domain' do
|
84
|
-
# we have to provide users from project to be able to do this by login
|
85
|
-
a, b = @p.resolve_roles('john.doe+in_domain@gooddata.com', 'test_role', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
|
86
|
-
expect(a).to eq "/gdc/account/profile/john.doe+in_domain@gooddata.com"
|
87
|
-
expect(b).to eq ["/roles/1"]
|
88
|
-
end
|
89
|
-
|
90
|
-
it 'Can handle case with user uri when user is in the domain' do
|
91
|
-
# we have to provide users from project to be able to do this by login
|
92
|
-
a, b = @p.resolve_roles('/uri/john_domain', 'test_role', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
|
93
|
-
expect(a).to eq "/uri/john_domain"
|
94
|
-
expect(b).to eq ["/roles/1"]
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'can handle case with info with uri when user is in the domain' do
|
98
|
-
# we have to provide users from project to be able to do this by login
|
99
|
-
a, b = @p.resolve_roles({ uri: '/uri/john_domain', first_name: 'John' }, 'test_role', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
|
100
|
-
expect(a).to eq "/uri/john_domain"
|
101
|
-
expect(b).to eq ["/roles/1"]
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'can handle case with info with login when he is in the domain' do
|
105
|
-
# we have to provide users from project to be able to do this by login
|
106
|
-
login = { login: 'john.doe+in_domain@gooddata.com', first_name: 'John' }
|
107
|
-
a, b = @p.resolve_roles(login, 'test_role',
|
108
|
-
project_users: [],
|
109
|
-
domain_users: @domain_members,
|
110
|
-
roles: @roles,
|
111
|
-
domain: @domain)
|
112
|
-
expect(a).to eq "/gdc/account/profile/john.doe+in_domain@gooddata.com"
|
113
|
-
expect(b).to eq ["/roles/1"]
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'can handle case with member when he is in the domain' do
|
117
|
-
# we have to provide users from project to be able to do this by login
|
118
|
-
a, b = @p.resolve_roles(@domain_members.first, 'test_role_2', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
|
119
|
-
expect(a).to eq "/uri/john_domain"
|
120
|
-
expect(b).to eq ["/roles/2"]
|
121
|
-
end
|
122
|
-
|
123
|
-
it 'can handle case with profile when the user is in the domain' do
|
124
|
-
# we have to provide users from project to be able to do this by login
|
125
|
-
a, b = @p.resolve_roles(@domain_members.first, 'test_role_2', project_users: [], domain_users: @domain_members, roles: @roles)
|
126
|
-
expect(a).to eq "/uri/john_domain"
|
127
|
-
expect(b).to eq ["/roles/2"]
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
@@ -1,98 +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
|
-
describe "Over-To data permissions implementation", :constraint => 'slow' do
|
10
|
-
before(:all) do
|
11
|
-
@spec = JSON.parse(File.read("./spec/data/blueprints/m_n_model.json"), :symbolize_names => true)
|
12
|
-
@client = ConnectionHelper.create_default_connection
|
13
|
-
@blueprint = GoodData::Model::ProjectBlueprint.new(@spec)
|
14
|
-
@project = @client.create_project_from_blueprint(@blueprint, :token => ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
|
15
|
-
@domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
|
16
|
-
@label = @project.attributes('attr.permission.id').label_by_name('label.permission.id.email')
|
17
|
-
|
18
|
-
data = [
|
19
|
-
['label.commits.id', 'fact.commits.lines_changed', 'dataset.users'],
|
20
|
-
[1, 1, 1],
|
21
|
-
[2, 3, 2],
|
22
|
-
[3, 5, 3]
|
23
|
-
]
|
24
|
-
@project.upload(data, @blueprint, 'dataset.commits')
|
25
|
-
|
26
|
-
data = [
|
27
|
-
["label.users.id", "label.users.id.email"],
|
28
|
-
[1, "tomas@gooddata.com"],
|
29
|
-
[2, "petr@gooddata.com"],
|
30
|
-
[3, "jirka@gooddata.com"]
|
31
|
-
]
|
32
|
-
@project.upload(data, @blueprint, 'dataset.users')
|
33
|
-
|
34
|
-
data = [
|
35
|
-
["label.permission.id", "label.permission.id.email"],
|
36
|
-
[1, "tomas@gooddata.com"],
|
37
|
-
[2, "petr@gooddata.com"],
|
38
|
-
[3, "jirka@gooddata.com"]
|
39
|
-
]
|
40
|
-
@project.upload(data, @blueprint, 'dataset.permission_users')
|
41
|
-
|
42
|
-
data = [
|
43
|
-
['label.visibility.id', 'dataset.permission_users', 'dataset.commits'],
|
44
|
-
[1, 1, 1],
|
45
|
-
[3, 1, 3]
|
46
|
-
]
|
47
|
-
@project.upload(data, @blueprint, 'dataset.visibility')
|
48
|
-
|
49
|
-
@variable = @project.create_variable(title: 'uaaa', attribute: @label.attribute).save
|
50
|
-
|
51
|
-
@attr1 = @project.attributes('attr.visibility.id')
|
52
|
-
@attr2 = @project.attributes('attr.commits.id')
|
53
|
-
|
54
|
-
@filters = [
|
55
|
-
{
|
56
|
-
login: ConnectionHelper::DEFAULT_USERNAME,
|
57
|
-
filters: [
|
58
|
-
{ label: @label.uri, values: ["tomas@gooddata.com"], over: @attr1.uri, to: @attr2.uri }
|
59
|
-
]
|
60
|
-
}
|
61
|
-
]
|
62
|
-
end
|
63
|
-
|
64
|
-
after(:all) do
|
65
|
-
@project.delete if @project
|
66
|
-
end
|
67
|
-
|
68
|
-
after(:each) do
|
69
|
-
@project.data_permissions.pmap(&:delete)
|
70
|
-
end
|
71
|
-
|
72
|
-
it "should fail if you are specifying OVER TO filter and variables. Variables do not support OVER TO" do
|
73
|
-
expect do
|
74
|
-
@project.add_variable_permissions(@filters, @variable)
|
75
|
-
end.to raise_exception
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should create an over to filter transparently" do
|
79
|
-
metric = @project.create_metric("SELECT SUM(#\"Fact.Commits.Lines Changed\")", :title => 'x')
|
80
|
-
expect(metric.execute).to eq 9
|
81
|
-
@project.add_data_permissions(@filters)
|
82
|
-
expect(metric.execute).to eq 6
|
83
|
-
|
84
|
-
r = @project.compute_report(left: [metric], top: ['label.users.id.email'])
|
85
|
-
expect(r.include_column?(['tomas@gooddata.com', 1])).to eq true
|
86
|
-
expect(r.include_column?(['jirka@gooddata.com', 5])).to eq true
|
87
|
-
expect(r.include_column?(['petr@gooddata.com', 3])).to eq false
|
88
|
-
|
89
|
-
data = [['label.visibility.id', 'dataset.permission_users', 'dataset.commits'], [1, 1, 1]]
|
90
|
-
@project.upload(data, @blueprint, 'dataset.visibility')
|
91
|
-
|
92
|
-
expect(metric.execute).to eq 1
|
93
|
-
r = @project.compute_report(left: [metric], top: ['label.users.id.email'])
|
94
|
-
expect(r.include_column?(['tomas@gooddata.com', 1])).to eq true
|
95
|
-
expect(r.include_column?(['jirka@gooddata.com', 5])).to eq false
|
96
|
-
expect(r.include_column?(['petr@gooddata.com', 3])).to eq false
|
97
|
-
end
|
98
|
-
end
|
@@ -1,41 +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
|
-
describe "Object export between projects", :constraint => 'slow' do
|
10
|
-
before(:all) do
|
11
|
-
@client = ConnectionHelper.create_default_connection
|
12
|
-
|
13
|
-
spec = MultiJson.load(File.read("./spec/data/blueprints/test_project_model_spec.json"), :symbolize_keys => true)
|
14
|
-
|
15
|
-
@source_project = @client.create_project_from_blueprint(spec, token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
|
16
|
-
@target_project = @client.create_project_from_blueprint(spec, token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
|
17
|
-
end
|
18
|
-
|
19
|
-
after(:all) do
|
20
|
-
@source_project.delete unless @source_project.nil?
|
21
|
-
@target_project.delete unless @target_project.nil?
|
22
|
-
|
23
|
-
@client.disconnect
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should transfer a metric" do
|
27
|
-
f = GoodData::Fact.find_first_by_title('Lines Changed', :client => @client, :project => @source_project)
|
28
|
-
metric_title = "Testing metric to be exported"
|
29
|
-
metric = @source_project.create_metric("SELECT SUM(#\"#{f.title}\")", :title => metric_title)
|
30
|
-
metric.save
|
31
|
-
|
32
|
-
expect(@target_project.metrics.count).to eq 0
|
33
|
-
|
34
|
-
@source_project.partial_md_export(metric, :project => @target_project)
|
35
|
-
|
36
|
-
expect(@target_project.metrics.count).to eq 1
|
37
|
-
metric = GoodData::Metric.find_first_by_title(metric_title, :client => @client, :project => @target_project)
|
38
|
-
expect(metric).not_to be_nil
|
39
|
-
expect(metric.title).to eq metric_title
|
40
|
-
end
|
41
|
-
end
|
@@ -1,381 +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 'pmap'
|
8
|
-
require 'gooddata'
|
9
|
-
|
10
|
-
describe GoodData::Project, :constraint => 'slow' do
|
11
|
-
before(:all) do
|
12
|
-
@client = ConnectionHelper.create_default_connection
|
13
|
-
@project = @client.create_project(title: ProjectHelper::PROJECT_TITLE, auth_token: ConnectionHelper::GD_PROJECT_TOKEN, environment: ProjectHelper::ENVIRONMENT)
|
14
|
-
@domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
|
15
|
-
end
|
16
|
-
|
17
|
-
after(:all) do
|
18
|
-
@project && @project.delete
|
19
|
-
@client.disconnect
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#add_user' do
|
23
|
-
it 'Adding user without domain should fail if it is not in the domain' do
|
24
|
-
user = ProjectHelper.create_random_user(@client)
|
25
|
-
expect do
|
26
|
-
@project.add_user(user, 'Admin')
|
27
|
-
end.to raise_exception(ArgumentError)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'Adding user with domain should be added to a project' do
|
31
|
-
user = ProjectHelper.create_random_user(@client)
|
32
|
-
@domain.create_users([user])
|
33
|
-
res = @project.add_user(user, 'Admin', domain: @domain)
|
34
|
-
login = GoodData::Helpers.last_uri_part(res['projectUsersUpdateResult']['successful'].first)
|
35
|
-
expect(@project.member?(login)).to be_truthy
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe '#add_users' do
|
40
|
-
it 'Adding user without domain should fail if it is not in the project' do
|
41
|
-
users = (1..5).to_a.map do
|
42
|
-
{
|
43
|
-
user: ProjectHelper.create_random_user(@client),
|
44
|
-
role: 'Admin'
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
res = @project.add_users(users)
|
49
|
-
expect(res.select { |r| r[:type] == :failed }.count).to eq users.length
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'Adding users with domain should pass and users should be added to domain' do
|
53
|
-
users = (1..5).to_a.map do
|
54
|
-
{
|
55
|
-
user: ProjectHelper.create_random_user(@client),
|
56
|
-
role: 'Admin'
|
57
|
-
}
|
58
|
-
end
|
59
|
-
@domain.create_users(users.map { |u| u[:user] })
|
60
|
-
res = @project.add_users(users, domain: @domain)
|
61
|
-
links = res.select { |r| r[:type] == :successful }.map { |i| GoodData::Helpers.last_uri_part(i[:user]) }
|
62
|
-
expect(@project.members?(links).all?).to be_truthy
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe '#import_users' do
|
67
|
-
it 'should add user which login contains a part of whitelists' do
|
68
|
-
users = [ProjectHelper.create_random_user(@client, login: "#{rand(1e7)}+rubydev+admin@gooddata.com")]
|
69
|
-
@domain.create_users(users)
|
70
|
-
@project.import_users(users, domain: @domain, whitelists: ['rubydev+admin@gooddata.com'])
|
71
|
-
expect(@domain.members?(users)).to be_truthy
|
72
|
-
expect(@project.members?(users)).to be_truthy
|
73
|
-
expect(@project.members.count).to eq 2
|
74
|
-
end
|
75
|
-
|
76
|
-
it "Updates user's name and surname and removes the users" do
|
77
|
-
users = (1..2).to_a.map { ProjectHelper.create_random_user(@client) }
|
78
|
-
@domain.create_users(users)
|
79
|
-
@project.import_users(users, domain: @domain, whitelists: [/admin@gooddata.com/])
|
80
|
-
expect(@domain.members?(users)).to be_truthy
|
81
|
-
expect(@project.members?(users)).to be_truthy
|
82
|
-
expect(@project.members.count).to eq 4
|
83
|
-
# update some user stuff
|
84
|
-
bill = users[0]
|
85
|
-
bill.first_name = 'buffalo'
|
86
|
-
bill.last_name = 'bill'
|
87
|
-
# import
|
88
|
-
@domain.create_users(users, domain: @domain, whitelists: [/admin@gooddata.com/])
|
89
|
-
@project.import_users(users, domain: @domain, whitelists: [/admin@gooddata.com/])
|
90
|
-
# it should be updated
|
91
|
-
bill_changed = @domain.get_user(bill)
|
92
|
-
expect(bill_changed.first_name).to eq 'buffalo'
|
93
|
-
expect(bill_changed.last_name).to eq 'bill'
|
94
|
-
expect(@project.members?(users)).to be_truthy
|
95
|
-
expect(@project.members.count).to eq 4
|
96
|
-
expect(@project.member?(bill_changed)).to be_truthy
|
97
|
-
|
98
|
-
# remove everybody but buffalo bill.
|
99
|
-
@project.import_users([bill], domain: @domain, whitelists: [/admin@gooddata.com/])
|
100
|
-
expect(@project.members.count).to eq 3
|
101
|
-
expect(@project.member?(bill)).to be_truthy
|
102
|
-
disabled_users = users - [bill]
|
103
|
-
expect(@project.members?(disabled_users).any?).to be_falsey
|
104
|
-
disabled_users.each do |user|
|
105
|
-
expect(@project.users(disabled: true).find { |member| member.login.downcase == user.login.downcase }).not_to be_nil
|
106
|
-
end
|
107
|
-
|
108
|
-
# remove completely everybody but buffalo bill.
|
109
|
-
@project.import_users([bill], domain: @domain, whitelists: [/admin@gooddata.com/], remove_users_from_project: true)
|
110
|
-
expect(@project.members.count).to eq 3
|
111
|
-
expect(@project.member?(bill)).to be_truthy
|
112
|
-
expect(@project.members?(disabled_users).any?).to be_falsey
|
113
|
-
disabled_users.each do |user|
|
114
|
-
expect(@project.users(disabled: true).find { |member| member.login.downcase == user.login.downcase }).to be_nil
|
115
|
-
end
|
116
|
-
|
117
|
-
# Add additional user while changing Buffalos surname and role.
|
118
|
-
bill.last_name = 'Billie'
|
119
|
-
other_guy = ProjectHelper.create_random_user(@client)
|
120
|
-
additional_batch = [bill, other_guy]
|
121
|
-
|
122
|
-
@domain.create_users(additional_batch, domain: @domain)
|
123
|
-
@project.import_users(additional_batch.map { |u| { user: u, role: u.role } }, domain: @domain, whitelists: [/admin@gooddata.com/])
|
124
|
-
|
125
|
-
expect(@project.members.count).to eq 4
|
126
|
-
expect(@project.member?(bill)).to be_truthy
|
127
|
-
expect(@project.members?(users - additional_batch).any?).to be_falsey
|
128
|
-
end
|
129
|
-
|
130
|
-
it "Updates user's role in a project" do
|
131
|
-
users = (1..5).to_a.map { ProjectHelper.create_random_user(@client).to_hash }
|
132
|
-
@domain.create_users(users, domain: @domain)
|
133
|
-
@project.import_users(users, domain: @domain, whitelists: [/admin@gooddata.com/])
|
134
|
-
|
135
|
-
expect(@project.members?(users)).to be_truthy
|
136
|
-
user_role_changed = users[1]
|
137
|
-
users_unchanged = users - [user_role_changed]
|
138
|
-
new_role = users[1][:role] = users[1][:role] == "admin" ? "editor" : "admin"
|
139
|
-
@project.import_users(users, domain: @domain, whitelists: [/admin@gooddata.com/])
|
140
|
-
expect(@project.get_user(user_role_changed).role.identifier).to eq "#{new_role}Role"
|
141
|
-
expect(users_unchanged.map { |u| @project.get_user(u) }.map(&:role).map(&:title).uniq).to eq ['Editor']
|
142
|
-
end
|
143
|
-
|
144
|
-
it "ignores user from both project and end state batch when whitelisted" do
|
145
|
-
u = @project.get_user(ConnectionHelper::DEFAULT_USERNAME)
|
146
|
-
uh = u.to_hash
|
147
|
-
uh[:role] = 'editor'
|
148
|
-
|
149
|
-
users = (1..5).to_a.map { ProjectHelper.create_random_user(@client).to_hash } + [uh]
|
150
|
-
@domain.create_users(users, domain: @domain)
|
151
|
-
expect(@project.member?(u)).to be_truthy
|
152
|
-
expect(u.role.title).to eq 'Admin'
|
153
|
-
@project.import_users(users, domain: @domain, whitelists: [/admin@gooddata.com/])
|
154
|
-
expect(@project.member?(u)).to be_truthy
|
155
|
-
expect(@project.members?(users).all?).to be_truthy
|
156
|
-
expect(@project.get_user(ConnectionHelper::DEFAULT_USERNAME).role.title).to eq 'Admin'
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'should downcase login' do
|
160
|
-
users = [ProjectHelper.create_random_user(@client, login: "#{rand(1e7)}+TMA-445+RubyDev+Admin@gooddata.com")]
|
161
|
-
@domain.create_users(users)
|
162
|
-
@project.import_users(users, domain: @domain, whitelists: ['rubydev+admin@gooddata.com'])
|
163
|
-
expect(@project.members?(users.map(&:to_hash).map { |u| u[:login].downcase! })).to be_truthy
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
describe '#set_user_roles' do
|
168
|
-
it 'Properly updates user roles as needed' do
|
169
|
-
users_to_import = @domain.users.drop(rand(100)).take(5).map { |u| { user: u, role: 'admin' } }
|
170
|
-
@project.import_users(users_to_import, domain: @domain, whitelists: [/admin@gooddata.com/])
|
171
|
-
users_without_owner = @project.users.reject { |u| u.login == ConnectionHelper::DEFAULT_USERNAME }.pselect { |u| u.role.title == 'Admin' }
|
172
|
-
|
173
|
-
user_to_change = users_without_owner.sample
|
174
|
-
@project.set_user_roles(user_to_change, 'editor')
|
175
|
-
expect(user_to_change.role.title).to eq 'Editor'
|
176
|
-
@project.set_user_roles(user_to_change, 'admin')
|
177
|
-
expect(user_to_change.role.title).to eq 'Admin'
|
178
|
-
|
179
|
-
# Try different notation
|
180
|
-
@project.set_users_roles([user: user_to_change, role: 'editor'])
|
181
|
-
expect(user_to_change.role.title).to eq 'Editor'
|
182
|
-
@project.set_users_roles([user: user_to_change, role: 'admin'])
|
183
|
-
expect(user_to_change.role.title).to eq 'Admin'
|
184
|
-
end
|
185
|
-
|
186
|
-
it 'Properly updates user roles when user specified by email and :roles specified as array of string with role names' do
|
187
|
-
# pick non deleted users that are not owner and have other roles than admin or editor
|
188
|
-
users = @project.users
|
189
|
-
users_without_owner = users
|
190
|
-
.reject { |u| u.login == ConnectionHelper::DEFAULT_USERNAME }
|
191
|
-
.reject { |u| u.login =~ /^deleted/ }
|
192
|
-
.pselect { |u| u.role.title =~ /^(Admin|Editor)/ }
|
193
|
-
|
194
|
-
# take 10 users that we will exercise
|
195
|
-
users_to_change = users_without_owner.sample(10)
|
196
|
-
|
197
|
-
# alternate roles and prepare structure
|
198
|
-
logins = users_to_change.map(&:login)
|
199
|
-
roles = users_to_change.map { |u| u.role.title == 'Admin' ? ['Editor'] : ['Admin'] }
|
200
|
-
|
201
|
-
list = users_to_change.map do |u|
|
202
|
-
{
|
203
|
-
:user => u.login,
|
204
|
-
:roles => u.role.title == 'Admin' ? ['Editor'] : ['Admin']
|
205
|
-
}
|
206
|
-
end
|
207
|
-
|
208
|
-
# set the roles
|
209
|
-
res = @project.set_users_roles(list)
|
210
|
-
expect(res.select { |r| r[:type] == :successful }.length).to equal(list.length)
|
211
|
-
expect(logins.map { |l| users.find { |u| u.login == l } }.pmap { |u| u.role.title }).to eq roles.flatten
|
212
|
-
end
|
213
|
-
|
214
|
-
it 'Properly updates user roles when user specified by email and :roles specified as string with role name' do
|
215
|
-
users = @project.users
|
216
|
-
users_without_owner = users
|
217
|
-
.reject { |u| u.login == ConnectionHelper::DEFAULT_USERNAME }
|
218
|
-
.reject(&:deleted?)
|
219
|
-
.pselect { |u| u.role.title =~ /^(Admin|Editor)/ }
|
220
|
-
|
221
|
-
users_to_change = users_without_owner.sample(10)
|
222
|
-
|
223
|
-
logins = users_to_change.map(&:login)
|
224
|
-
roles = users_to_change.map { |u| u.role.title == 'Admin' ? 'Editor' : 'Admin' }
|
225
|
-
|
226
|
-
list = users_to_change.map do |u|
|
227
|
-
{
|
228
|
-
:user => u.login,
|
229
|
-
:roles => u.role.title == 'Admin' ? 'Editor' : 'Admin'
|
230
|
-
}
|
231
|
-
end
|
232
|
-
|
233
|
-
res = @project.set_users_roles(list)
|
234
|
-
expect(res.select { |r| r[:type] == :successful }.length).to equal(list.length)
|
235
|
-
expect(logins.map { |l| users.find { |u| u.login == l } }.pmap { |u| u.role.title }).to eq roles.flatten
|
236
|
-
end
|
237
|
-
|
238
|
-
it 'can work with groups as well. Groups have to be set up. It can only eat hashes on input in this case' do
|
239
|
-
users = (1..5).to_a.map { ProjectHelper.create_random_user(@client).to_hash }
|
240
|
-
group_names = %w(group_1 group_2)
|
241
|
-
groups = group_names.map { |g| @project.create_group(name: g) }
|
242
|
-
users_with_groups = users.map do |u|
|
243
|
-
u[:user_group] = groups.take(rand(2) + 1).map(&:name)
|
244
|
-
u
|
245
|
-
end
|
246
|
-
@domain.create_users(users_with_groups, domain: @domain)
|
247
|
-
@project.import_users(users_with_groups, domain: @domain, whitelists: [/admin@gooddata.com/])
|
248
|
-
expect(users_with_groups.flat_map { |u| u[:user_group].map { |g| [u[:login], g] } }.all? do |u, g|
|
249
|
-
begin
|
250
|
-
@project.user_groups(g).member?(@project.member(u).uri)
|
251
|
-
rescue
|
252
|
-
false
|
253
|
-
end
|
254
|
-
end).to be_truthy
|
255
|
-
|
256
|
-
users_with_group = users.map do |u|
|
257
|
-
u[:user_group] = ['group_1']
|
258
|
-
u
|
259
|
-
end
|
260
|
-
to_whitelist = @project.user_groups('group_2').members.to_a.sample
|
261
|
-
@project.import_users(users_with_group, domain: @domain, whitelists: [to_whitelist.login, /admin@gooddata.com/])
|
262
|
-
expect(@project.user_groups('group_2').members.map(&:login)).to eq [to_whitelist.login]
|
263
|
-
expect(users_with_group.flat_map { |u| u[:user_group].map { |g| [u[:login], g] } }.all? do |u, g|
|
264
|
-
begin
|
265
|
-
@project.user_groups(g).member?(@project.member(u).uri)
|
266
|
-
rescue
|
267
|
-
false
|
268
|
-
end
|
269
|
-
end).to be_truthy
|
270
|
-
end
|
271
|
-
|
272
|
-
it 'can auto create groups and work with them' do
|
273
|
-
new_group = 'new_group'
|
274
|
-
u = @project.get_user(ConnectionHelper::DEFAULT_USERNAME)
|
275
|
-
uh = u.to_hash
|
276
|
-
uh[:user_group] = [new_group]
|
277
|
-
|
278
|
-
expect(@project.user_groups(new_group)).to be_nil
|
279
|
-
expect do
|
280
|
-
@project.import_users([uh], domain: @domain, whitelists: [/admin@gooddata.com/])
|
281
|
-
end.to raise_exception
|
282
|
-
|
283
|
-
@project.import_users([uh], domain: @domain, whitelists: [/admin@gooddata.com/], create_non_existing_user_groups: true)
|
284
|
-
expect(@project.user_groups(new_group)).not_to be_nil
|
285
|
-
expect(@project.user_groups(new_group).member?(u.uri)).to be_truthy
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
describe '#summary' do
|
290
|
-
it 'Properly gets summary of project' do
|
291
|
-
res = @project.summary
|
292
|
-
expect(res).to include(ProjectHelper::PROJECT_SUMMARY)
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
describe '#title' do
|
297
|
-
it 'Properly gets title of project' do
|
298
|
-
res = @project.title
|
299
|
-
expect(res).to include(ProjectHelper::PROJECT_TITLE)
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
describe 'enabling and disabling users' do
|
304
|
-
it 'should be able to enable and disable a user' do
|
305
|
-
users_without_owner = @project.users
|
306
|
-
.reject { |u| u.login == ConnectionHelper::DEFAULT_USERNAME }
|
307
|
-
.reject(&:deleted?)
|
308
|
-
.select(&:enabled?)
|
309
|
-
user = users_without_owner.sample
|
310
|
-
expect(user.enabled?).to be_truthy
|
311
|
-
expect(user.disabled?).to be_falsey
|
312
|
-
user.disable
|
313
|
-
expect(user.disabled?).to be_truthy
|
314
|
-
expect(user.enabled?).to be_falsey
|
315
|
-
user.enable
|
316
|
-
expect(user.enabled?).to be_truthy
|
317
|
-
expect(user.disabled?).to be_falsey
|
318
|
-
expect(user.project).not_to be_nil
|
319
|
-
end
|
320
|
-
end
|
321
|
-
|
322
|
-
describe 'color palette' do
|
323
|
-
it 'should return empty when project is not set color' do
|
324
|
-
expect(@project.current_color_palette.colors).to eq []
|
325
|
-
end
|
326
|
-
|
327
|
-
it 'should be able to set custom color' do
|
328
|
-
colors = [
|
329
|
-
{
|
330
|
-
guid: 'first',
|
331
|
-
fill: {
|
332
|
-
r: 155,
|
333
|
-
g: 255,
|
334
|
-
b: 0
|
335
|
-
}
|
336
|
-
}
|
337
|
-
]
|
338
|
-
@project.create_custom_color_palette(colors)
|
339
|
-
expect(@project.current_color_palette.colors).to eq colors.map { |color| GoodData::Helpers.stringify_keys(color) }
|
340
|
-
end
|
341
|
-
|
342
|
-
it 'should be able to reset custom color' do
|
343
|
-
colors = [
|
344
|
-
{
|
345
|
-
guid: 'first',
|
346
|
-
fill: {
|
347
|
-
r: 155,
|
348
|
-
g: 255,
|
349
|
-
b: 0
|
350
|
-
}
|
351
|
-
}
|
352
|
-
]
|
353
|
-
@project.create_custom_color_palette(colors)
|
354
|
-
@project.reset_color_palette
|
355
|
-
expect(@project.current_color_palette.colors).to eq []
|
356
|
-
end
|
357
|
-
|
358
|
-
it 'should not contains duplicate color' do
|
359
|
-
colors = [
|
360
|
-
{
|
361
|
-
guid: 'first',
|
362
|
-
fill: {
|
363
|
-
r: 155,
|
364
|
-
g: 255,
|
365
|
-
b: 0
|
366
|
-
}
|
367
|
-
},
|
368
|
-
{
|
369
|
-
guid: 'first',
|
370
|
-
fill: {
|
371
|
-
r: 155,
|
372
|
-
g: 255,
|
373
|
-
b: 0
|
374
|
-
}
|
375
|
-
}
|
376
|
-
]
|
377
|
-
@project.create_custom_color_palette(colors)
|
378
|
-
expect(@project.current_color_palette.colors).to eq [{ "guid" => "first", "fill" => { "r" => 155, "g" => 255, "b" => 0 } }]
|
379
|
-
end
|
380
|
-
end
|
381
|
-
end
|