gooddata 0.6.20 → 0.6.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -1
- data/DEPENDENCIES.md +816 -0
- data/LICENSE +1 -1
- data/LICENSE.rb +5 -0
- data/Rakefile +74 -22
- data/dependency_decisions.yml +102 -0
- data/gooddata.gemspec +39 -38
- data/lib/gooddata.rb +4 -0
- data/lib/gooddata/app/app.rb +4 -0
- data/lib/gooddata/bricks/base_downloader.rb +5 -1
- data/lib/gooddata/bricks/brick.rb +4 -0
- data/lib/gooddata/bricks/bricks.rb +5 -0
- data/lib/gooddata/bricks/middleware/aws_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/base_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/bench_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/decode_params_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/fs_download_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +6 -0
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +4 -0
- data/lib/gooddata/bricks/middleware/stdout_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +5 -0
- data/lib/gooddata/bricks/middleware/undot_params_middleware.rb +4 -0
- data/lib/gooddata/bricks/pipeline.rb +4 -0
- data/lib/gooddata/bricks/utils.rb +4 -0
- data/lib/gooddata/cli/cli.rb +4 -0
- data/lib/gooddata/cli/commands/api_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/auth_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/console_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/domain_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/process_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/project_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/projects_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +4 -0
- data/lib/gooddata/cli/commands/user_cmd.rb +4 -0
- data/lib/gooddata/cli/hooks.rb +4 -0
- data/lib/gooddata/cli/shared.rb +4 -0
- data/lib/gooddata/cli/terminal.rb +4 -0
- data/lib/gooddata/client.rb +4 -0
- data/lib/gooddata/commands/api.rb +4 -0
- data/lib/gooddata/commands/auth.rb +4 -0
- data/lib/gooddata/commands/base.rb +4 -0
- data/lib/gooddata/commands/commands.rb +5 -0
- data/lib/gooddata/commands/datasets.rb +5 -1
- data/lib/gooddata/commands/datawarehouse.rb +4 -0
- data/lib/gooddata/commands/domain.rb +4 -0
- data/lib/gooddata/commands/process.rb +4 -0
- data/lib/gooddata/commands/project.rb +7 -9
- data/lib/gooddata/commands/projects.rb +4 -0
- data/lib/gooddata/commands/role.rb +4 -0
- data/lib/gooddata/commands/runners.rb +4 -0
- data/lib/gooddata/commands/scaffold.rb +4 -0
- data/lib/gooddata/commands/user.rb +4 -0
- data/lib/gooddata/connection.rb +83 -0
- data/lib/gooddata/core/core.rb +4 -0
- data/lib/gooddata/core/logging.rb +4 -0
- data/lib/gooddata/core/nil_logger.rb +4 -0
- data/lib/gooddata/core/project.rb +4 -0
- data/lib/gooddata/core/rest.rb +14 -16
- data/lib/gooddata/core/user.rb +4 -0
- data/lib/gooddata/data/data.rb +4 -0
- data/lib/gooddata/data/guesser.rb +4 -0
- data/lib/gooddata/exceptions/attr_element_not_found.rb +4 -0
- data/lib/gooddata/exceptions/command_failed.rb +4 -0
- data/lib/gooddata/exceptions/exceptions.rb +4 -0
- data/lib/gooddata/exceptions/execution_limit_exceeded.rb +4 -0
- data/lib/gooddata/exceptions/filter_maqlization.rb +16 -0
- data/lib/gooddata/exceptions/malformed_user.rb +15 -0
- data/lib/gooddata/exceptions/no_project_error.rb +4 -0
- data/lib/gooddata/exceptions/object_migration.rb +28 -0
- data/lib/gooddata/exceptions/project_not_found.rb +5 -0
- data/lib/gooddata/exceptions/uncomputable_report.rb +5 -0
- data/lib/gooddata/exceptions/user_in_different_domain.rb +4 -0
- data/lib/gooddata/exceptions/validation_error.rb +4 -0
- data/lib/gooddata/extensions/big_decimal.rb +4 -0
- data/lib/gooddata/extensions/enumerable.rb +4 -0
- data/lib/gooddata/extensions/extensions.rb +4 -0
- data/lib/gooddata/extensions/false.rb +4 -0
- data/lib/gooddata/extensions/hash.rb +4 -0
- data/lib/gooddata/extensions/nil.rb +4 -0
- data/lib/gooddata/extensions/numeric.rb +4 -0
- data/lib/gooddata/extensions/object.rb +4 -0
- data/lib/gooddata/extensions/symbol.rb +4 -0
- data/lib/gooddata/extensions/true.rb +4 -0
- data/lib/gooddata/extract.rb +4 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +87 -77
- data/lib/gooddata/helpers/auth_helpers.rb +6 -2
- data/lib/gooddata/helpers/csv_helper.rb +4 -0
- data/lib/gooddata/helpers/data_helper.rb +4 -0
- data/lib/gooddata/helpers/global_helpers.rb +35 -6
- data/lib/gooddata/helpers/global_helpers_params.rb +34 -7
- data/lib/gooddata/helpers/helpers.rb +4 -0
- data/lib/gooddata/mixins/author.rb +4 -0
- data/lib/gooddata/mixins/content_getter.rb +4 -0
- data/lib/gooddata/mixins/content_property_reader.rb +4 -0
- data/lib/gooddata/mixins/content_property_writer.rb +4 -0
- data/lib/gooddata/mixins/contributor.rb +4 -0
- data/lib/gooddata/mixins/data_getter.rb +4 -0
- data/lib/gooddata/mixins/data_property_reader.rb +4 -0
- data/lib/gooddata/mixins/data_property_writer.rb +4 -0
- data/lib/gooddata/mixins/inspector.rb +4 -0
- data/lib/gooddata/mixins/is_attribute.rb +4 -0
- data/lib/gooddata/mixins/is_dimension.rb +4 -0
- data/lib/gooddata/mixins/is_fact.rb +4 -0
- data/lib/gooddata/mixins/is_label.rb +4 -0
- data/lib/gooddata/mixins/links.rb +4 -0
- data/lib/gooddata/mixins/md_finders.rb +4 -0
- data/lib/gooddata/mixins/md_id_to_uri.rb +4 -0
- data/lib/gooddata/mixins/md_json.rb +4 -0
- data/lib/gooddata/mixins/md_lock.rb +4 -0
- data/lib/gooddata/mixins/md_object_id.rb +5 -1
- data/lib/gooddata/mixins/md_object_indexer.rb +4 -0
- data/lib/gooddata/mixins/md_object_query.rb +4 -0
- data/lib/gooddata/mixins/md_relations.rb +4 -0
- data/lib/gooddata/mixins/meta_getter.rb +4 -0
- data/lib/gooddata/mixins/meta_property_reader.rb +4 -0
- data/lib/gooddata/mixins/meta_property_writer.rb +4 -0
- data/lib/gooddata/mixins/mixins.rb +4 -0
- data/lib/gooddata/mixins/not_attribute.rb +4 -0
- data/lib/gooddata/mixins/not_exportable.rb +4 -0
- data/lib/gooddata/mixins/not_fact.rb +4 -0
- data/lib/gooddata/mixins/not_label.rb +4 -0
- data/lib/gooddata/mixins/not_metric.rb +6 -0
- data/lib/gooddata/mixins/obj_id.rb +4 -0
- data/lib/gooddata/mixins/rest_getters.rb +4 -0
- data/lib/gooddata/mixins/rest_resource.rb +4 -0
- data/lib/gooddata/mixins/root_key_getter.rb +4 -0
- data/lib/gooddata/mixins/root_key_setter.rb +4 -0
- data/lib/gooddata/mixins/timestamps.rb +4 -0
- data/lib/gooddata/models/blueprint/anchor_field.rb +4 -0
- data/lib/gooddata/models/blueprint/attribute_field.rb +4 -0
- data/lib/gooddata/models/blueprint/blueprint.rb +4 -0
- data/lib/gooddata/models/blueprint/blueprint_field.rb +4 -0
- data/lib/gooddata/models/blueprint/dashboard_builder.rb +4 -0
- data/lib/gooddata/models/blueprint/dataset_blueprint.rb +6 -0
- data/lib/gooddata/models/blueprint/date_dimension.rb +4 -0
- data/lib/gooddata/models/blueprint/fact_field.rb +4 -0
- data/lib/gooddata/models/blueprint/label_field.rb +4 -0
- data/lib/gooddata/models/blueprint/project_blueprint.rb +6 -0
- data/lib/gooddata/models/blueprint/project_builder.rb +4 -0
- data/lib/gooddata/models/blueprint/reference_field.rb +4 -0
- data/lib/gooddata/models/blueprint/schema_blueprint.rb +4 -0
- data/lib/gooddata/models/blueprint/schema_builder.rb +4 -0
- data/lib/gooddata/models/blueprint/to_manifest.rb +17 -1
- data/lib/gooddata/models/blueprint/to_wire.rb +4 -0
- data/lib/gooddata/models/datawarehouse.rb +5 -0
- data/lib/gooddata/models/domain.rb +25 -7
- data/lib/gooddata/models/execution.rb +4 -0
- data/lib/gooddata/models/execution_detail.rb +4 -0
- data/lib/gooddata/models/from_wire.rb +4 -0
- data/lib/gooddata/models/invitation.rb +4 -0
- data/lib/gooddata/models/links.rb +4 -0
- data/lib/gooddata/models/membership.rb +4 -0
- data/lib/gooddata/models/metadata.rb +37 -10
- data/lib/gooddata/models/metadata/attribute.rb +6 -0
- data/lib/gooddata/models/metadata/dashboard.rb +54 -16
- data/lib/gooddata/models/metadata/dashboard/dashboard_item.rb +60 -0
- data/lib/gooddata/models/metadata/dashboard/filter_item.rb +15 -0
- data/lib/gooddata/models/metadata/dashboard/report_item.rb +51 -0
- data/lib/gooddata/models/metadata/dashboard_tab.rb +88 -0
- data/lib/gooddata/models/metadata/dataset.rb +4 -0
- data/lib/gooddata/models/metadata/dimension.rb +4 -0
- data/lib/gooddata/models/metadata/fact.rb +6 -0
- data/lib/gooddata/models/metadata/label.rb +15 -0
- data/lib/gooddata/models/metadata/metadata.rb +4 -0
- data/lib/gooddata/models/metadata/metric.rb +5 -4
- data/lib/gooddata/models/metadata/report.rb +62 -16
- data/lib/gooddata/models/metadata/report_definition.rb +44 -47
- data/lib/gooddata/models/metadata/variable.rb +4 -0
- data/lib/gooddata/models/model.rb +85 -36
- data/lib/gooddata/models/models.rb +4 -0
- data/lib/gooddata/models/module_constants.rb +4 -0
- data/lib/gooddata/models/process.rb +4 -0
- data/lib/gooddata/models/profile.rb +13 -0
- data/lib/gooddata/models/project.rb +173 -92
- data/lib/gooddata/models/project_creator.rb +18 -10
- data/lib/gooddata/models/project_metadata.rb +4 -0
- data/lib/gooddata/models/project_role.rb +4 -0
- data/lib/gooddata/models/report_data_result.rb +217 -125
- data/lib/gooddata/models/schedule.rb +140 -65
- data/lib/gooddata/models/tab_builder.rb +4 -0
- data/lib/gooddata/models/user_filters/mandatory_user_filter.rb +4 -0
- data/lib/gooddata/models/user_filters/user_filter.rb +4 -0
- data/lib/gooddata/models/user_filters/user_filter_builder.rb +98 -56
- data/lib/gooddata/models/user_filters/user_filters.rb +4 -0
- data/lib/gooddata/models/user_filters/variable_user_filter.rb +4 -0
- data/lib/gooddata/rest/client.rb +41 -38
- data/lib/gooddata/rest/connection.rb +91 -20
- data/lib/gooddata/rest/connections/rest_client_connection.rb +5 -1
- data/lib/gooddata/rest/object.rb +9 -1
- data/lib/gooddata/rest/object_factory.rb +5 -1
- data/lib/gooddata/rest/resource.rb +5 -1
- data/lib/gooddata/rest/rest.rb +4 -0
- data/lib/gooddata/version.rb +5 -1
- data/spec/bricks/bricks_spec.rb +4 -0
- data/spec/data/blueprints/test_project_model_spec.json +2 -2
- data/spec/data/gooddata_version_process/gooddata_version.rb +6 -0
- data/spec/data/hello_world_process/hello_world.rb +6 -0
- data/spec/data/manifests/test_project.json +5 -5
- data/spec/data/reports/left_attr_report.json +108 -0
- data/spec/data/reports/metric_only_one_line.json +83 -0
- data/spec/data/reports/report_1.json +197 -0
- data/spec/data/reports/top_attr_report.json +108 -0
- data/spec/data/ruby_params_process/ruby_params.rb +6 -0
- data/spec/data/ruby_process/process.rb +6 -0
- data/spec/environment/default.rb +5 -0
- data/spec/environment/develop.rb +10 -5
- data/spec/environment/environment.rb +4 -0
- data/spec/environment/hotfix.rb +5 -1
- data/spec/environment/production.rb +4 -0
- data/spec/environment/release.rb +4 -0
- data/spec/environment/staging.rb +30 -0
- data/spec/environment/staging_3.rb +37 -0
- data/spec/helpers/blueprint_helper.rb +4 -0
- data/spec/helpers/cli_helper.rb +4 -0
- data/spec/helpers/connection_helper.rb +24 -17
- data/spec/helpers/crypto_helper.rb +6 -0
- data/spec/helpers/csv_helper.rb +4 -0
- data/spec/helpers/process_helper.rb +5 -1
- data/spec/helpers/project_helper.rb +34 -29
- data/spec/helpers/schedule_helper.rb +4 -0
- data/spec/helpers/spec_helper.rb +4 -0
- data/spec/integration/blueprint_updates_spec.rb +28 -20
- data/spec/integration/command_datawarehouse_spec.rb +6 -0
- data/spec/integration/command_projects_spec.rb +6 -4
- data/spec/integration/create_from_template_spec.rb +6 -0
- data/spec/integration/create_project_spec.rb +6 -0
- data/spec/integration/deprecated_load_spec.rb +58 -0
- data/spec/integration/full_process_schedule_spec.rb +9 -0
- data/spec/integration/full_project_spec.rb +63 -9
- data/spec/integration/over_to_user_filters_spec.rb +7 -2
- data/spec/integration/partial_md_export_import_spec.rb +6 -0
- data/spec/integration/project_spec.rb +12 -6
- data/spec/integration/rest_spec.rb +6 -2
- data/spec/integration/schedule_spec.rb +627 -0
- data/spec/integration/user_filters_spec.rb +122 -21
- data/spec/integration/variables_spec.rb +8 -15
- data/spec/logging_in_logging_out_spec.rb +58 -0
- data/spec/spec_helper.rb +10 -5
- data/spec/unit/bricks/bricks_spec.rb +4 -0
- data/spec/unit/bricks/middleware/aws_middelware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +4 -0
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +4 -0
- data/spec/unit/cli/cli_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_api_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_auth_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_domain_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_process_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_project_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_role_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +4 -0
- data/spec/unit/cli/commands/cmd_scaffold_spec.rb +6 -0
- data/spec/unit/cli/commands/cmd_user_spec.rb +6 -0
- data/spec/unit/commands/command_api_spec.rb +6 -0
- data/spec/unit/commands/command_auth_spec.rb +6 -0
- data/spec/unit/commands/command_dataset_spec.rb +10 -4
- data/spec/unit/commands/command_process_spec.rb +6 -0
- data/spec/unit/commands/command_projects_spec.rb +6 -0
- data/spec/unit/commands/command_scaffold_spec.rb +6 -0
- data/spec/unit/commands/command_user_spec.rb +6 -0
- data/spec/unit/core/connection_spec.rb +6 -0
- data/spec/unit/core/logging_spec.rb +4 -0
- data/spec/unit/core/nil_logger_spec.rb +4 -0
- data/spec/unit/core/project_spec.rb +4 -0
- data/spec/unit/data/guesser_spec.rb +6 -2
- data/spec/unit/extensions/hash_spec.rb +4 -0
- data/spec/unit/godzilla/goodzilla_spec.rb +4 -0
- data/spec/unit/helpers/csv_helper_spec.rb +4 -0
- data/spec/unit/helpers/data_helper_spec.rb +4 -0
- data/spec/unit/helpers/global_helpers_spec.rb +54 -0
- data/spec/unit/helpers_spec.rb +6 -1
- data/spec/unit/models/blueprint/attributes_spec.rb +5 -0
- data/spec/unit/models/blueprint/dataset_spec.rb +5 -0
- data/spec/unit/models/blueprint/labels_spec.rb +5 -0
- data/spec/unit/models/blueprint/project_blueprint_spec.rb +5 -0
- data/spec/unit/models/blueprint/reference_spec.rb +5 -0
- data/spec/unit/models/blueprint/schema_builder_spec.rb +4 -0
- data/spec/unit/models/blueprint/to_wire_spec.rb +5 -0
- data/spec/unit/models/domain_spec.rb +9 -7
- data/spec/unit/models/execution_spec.rb +6 -0
- data/spec/unit/models/from_wire_spec.rb +4 -0
- data/spec/unit/models/invitation_spec.rb +4 -0
- data/spec/unit/models/membership_spec.rb +4 -0
- data/spec/unit/models/metadata_spec.rb +46 -0
- data/spec/unit/models/metric_spec.rb +4 -0
- data/spec/unit/models/model_spec.rb +4 -0
- data/spec/unit/models/params_spec.rb +4 -0
- data/spec/unit/models/profile_spec.rb +4 -0
- data/spec/unit/models/project_creator_spec.rb +127 -0
- data/spec/unit/models/project_role_spec.rb +4 -0
- data/spec/unit/models/project_spec.rb +4 -0
- data/spec/unit/models/report_result_data_spec.rb +193 -0
- data/spec/unit/models/schedule_spec.rb +241 -386
- data/spec/unit/models/to_manifest_spec.rb +21 -0
- data/spec/unit/models/{unit_project.rb → unit_project_spec.rb} +21 -18
- data/spec/unit/models/user_filters_spec.rb +7 -1
- data/spec/unit/models/variable_spec.rb +6 -0
- data/spec/unit/rest/polling_spec.rb +8 -5
- data/spec/unit/rest/resource_spec.rb +4 -0
- metadata +190 -129
- data/.autotest +0 -2
- data/.travis.yml +0 -22
- data/examples.rb +0 -69
- data/lib/gooddata/models/data_result.rb +0 -38
- data/lib/gooddata/models/empty_result.rb +0 -57
- data/spec/unit/models/project_creator.rb +0 -73
@@ -1,3 +1,9 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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
|
+
|
1
7
|
require 'gooddata'
|
2
8
|
|
3
9
|
describe "User filters implementation", :constraint => 'slow' do
|
@@ -14,7 +20,8 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
14
20
|
["lines_changed","committed_on","dev_id","repo_id"],
|
15
21
|
[1,"01/01/2014",1,1],
|
16
22
|
[3,"01/02/2014",2,2],
|
17
|
-
[5,"05/02/2014",3,1]
|
23
|
+
[5,"05/02/2014",3,1],
|
24
|
+
[6,"05/02/2014",1,2]]
|
18
25
|
@project.upload(commits_data, blueprint, 'dataset.commits')
|
19
26
|
|
20
27
|
devs_data = [
|
@@ -23,6 +30,13 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
23
30
|
[2, "petr@gooddata.com"],
|
24
31
|
[3, "jirka@gooddata.com"]]
|
25
32
|
@project.upload(devs_data, blueprint, 'dataset.devs')
|
33
|
+
|
34
|
+
repos_data = [
|
35
|
+
["repo_id", "repo_name"],
|
36
|
+
[1, "goodot"],
|
37
|
+
[2, "bam"],
|
38
|
+
[3, "infra"]]
|
39
|
+
@project.upload(repos_data, blueprint, 'dataset.repos')
|
26
40
|
end
|
27
41
|
|
28
42
|
after(:all) do
|
@@ -40,25 +54,23 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
40
54
|
# [jirka@gooddata.com | petr@gooddata.com | tomas@gooddata.com]
|
41
55
|
# [5.0 | 3.0 | 1.0 ]
|
42
56
|
|
43
|
-
metric.execute.should ==
|
57
|
+
metric.execute.should == 15
|
44
58
|
@project.add_data_permissions(filters)
|
45
|
-
metric.execute.should ==
|
59
|
+
metric.execute.should == 12
|
46
60
|
r = @project.compute_report(left: [metric], top: [@label.attribute])
|
47
|
-
|
48
|
-
r.include_column?(['tomas@gooddata.com', 1]).should == true
|
61
|
+
r.include_column?(['tomas@gooddata.com', 7]).should == true
|
49
62
|
r.include_column?(['jirka@gooddata.com', 5]).should == true
|
50
63
|
r.include_column?(['petr@gooddata.com', 3]).should == false
|
51
64
|
end
|
52
65
|
|
53
|
-
it "should
|
66
|
+
it "should return errors when asked to set a user not in project. Some filters are set up though." do
|
54
67
|
filters = [
|
55
68
|
['nonexistent_user@gooddata.com', @label.uri, "tomas@gooddata.com"],
|
56
69
|
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]
|
57
70
|
]
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
expect(@project.data_permissions.count).to eq 0
|
71
|
+
results = @project.add_data_permissions(filters)
|
72
|
+
expect(results[:results].any? { |r| r[:status] == :failed }).to be_truthy
|
73
|
+
expect(@project.data_permissions.count).to eq 2
|
62
74
|
end
|
63
75
|
|
64
76
|
it "should pass and set users that are in the projects" do
|
@@ -74,18 +86,41 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
74
86
|
['nonexistent_user@gooddata.com', @label.uri, 'tomas@gooddata.com'],
|
75
87
|
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, 'tomas@gooddata.com']
|
76
88
|
]
|
89
|
+
# note that filters will be set up even for nonexistent users but they will not be assigned
|
77
90
|
@project.add_data_permissions(filters, users_must_exist: false)
|
78
|
-
expect(@project.data_permissions.count).to eq 1
|
79
|
-
expect(@project.data_permissions.first.pretty_expression).to eq "[Dev] IN ([tomas@gooddata.com])"
|
91
|
+
expect(@project.data_permissions.select(&:related_uri).count).to eq 1
|
92
|
+
expect(@project.data_permissions.select(&:related_uri).first.pretty_expression).to eq "[Dev] IN ([tomas@gooddata.com])"
|
80
93
|
end
|
81
94
|
|
82
95
|
it "should fail when asked to set a value not in the project" do
|
83
96
|
filters = [
|
84
|
-
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, '%^&*( nonexistent value', 'tomas@gooddata.com']
|
85
|
-
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, 'tomas@gooddata.com']]
|
97
|
+
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, '%^&*( nonexistent value', 'tomas@gooddata.com']]
|
86
98
|
expect do
|
87
99
|
@project.add_data_permissions(filters)
|
88
100
|
end.to raise_error
|
101
|
+
begin
|
102
|
+
@project.add_data_permissions(filters)
|
103
|
+
rescue GoodData::FilterMaqlizationError => e
|
104
|
+
expect(e.errors.count).to eq 1
|
105
|
+
end
|
106
|
+
expect(@project.data_permissions.count).to eq 0
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'should fail but return all values if specified' do
|
110
|
+
domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
|
111
|
+
u = domain.users.find { |u| u.login != ConnectionHelper::DEFAULT_USERNAME }
|
112
|
+
filters = [
|
113
|
+
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, '%^&*( nonexistent value', 'tomas@gooddata.com'],
|
114
|
+
[u.login, @label.uri, '%^&*( other nonexistent value', 'jirka@gooddata.com']
|
115
|
+
]
|
116
|
+
expect do
|
117
|
+
@project.add_data_permissions(filters, fail_early: false)
|
118
|
+
end.to raise_error
|
119
|
+
begin
|
120
|
+
@project.add_data_permissions(filters, fail_early: false)
|
121
|
+
rescue GoodData::FilterMaqlizationError => e
|
122
|
+
expect(e.errors.count).to eq 2
|
123
|
+
end
|
89
124
|
expect(@project.data_permissions.count).to eq 0
|
90
125
|
end
|
91
126
|
|
@@ -102,13 +137,10 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
102
137
|
u = domain.users.find { |u| u.login != ConnectionHelper::DEFAULT_USERNAME }
|
103
138
|
|
104
139
|
filters = [[u.login, @label.uri, "tomas@gooddata.com"]]
|
105
|
-
|
106
|
-
@project.add_data_permissions(filters)
|
107
|
-
end.to raise_error
|
108
|
-
@project.add_data_permissions(filters, :domain => domain)
|
140
|
+
results = @project.add_data_permissions(filters)
|
109
141
|
filters = @project.data_permissions
|
110
142
|
expect(filters.first.related.login).to eq u.login
|
111
|
-
expect(filters.count).to eq 1
|
143
|
+
expect(filters.select(&:related_uri).count).to eq 1
|
112
144
|
expect(filters.first.pretty_expression).to eq "[Dev] IN ([tomas@gooddata.com])"
|
113
145
|
end
|
114
146
|
|
@@ -146,9 +178,10 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
146
178
|
|
147
179
|
it "should set up false if all values are nonexistent" do
|
148
180
|
metric = GoodData::Fact.find_first_by_title('Lines Changed', client: @client, project: @project).create_metric
|
181
|
+
|
149
182
|
filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "NONEXISTENT1", "NONEXISTENT2", "NONEXISTENT3"]]
|
150
183
|
@project.add_data_permissions(filters, ignore_missing_values: true)
|
151
|
-
expect(metric.execute).to eq
|
184
|
+
expect(metric.execute).to eq 15
|
152
185
|
@project.add_data_permissions(filters, ignore_missing_values: true, restrict_if_missing_all_values: true)
|
153
186
|
expect(metric.execute).to eq nil
|
154
187
|
end
|
@@ -177,7 +210,7 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
177
210
|
end
|
178
211
|
|
179
212
|
it "should be able to update the filter value" do
|
180
|
-
|
213
|
+
skip('We cannot swap filters yet')
|
181
214
|
filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com", "jirka@gooddata.com"]]
|
182
215
|
@project.add_data_permissions(filters)
|
183
216
|
perm = @project.data_permissions.first
|
@@ -185,4 +218,72 @@ describe "User filters implementation", :constraint => 'slow' do
|
|
185
218
|
@project.add_data_permissions(filters)
|
186
219
|
expect(perm.reload!.pretty_expression).to eq '[Dev] IN ([tomas@gooddata.com, jirka@gooddata.com])'
|
187
220
|
end
|
221
|
+
|
222
|
+
it 'should not create any superfluous filters if things go well' do
|
223
|
+
# first create some filters. This will error out and some filters will stay there
|
224
|
+
filters = [
|
225
|
+
['nonexistent_user@gooddata.com', @label.uri, "tomas@gooddata.com"],
|
226
|
+
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]
|
227
|
+
]
|
228
|
+
results = @project.add_data_permissions(filters)
|
229
|
+
|
230
|
+
# now let's do a correct run
|
231
|
+
filters = [
|
232
|
+
[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]
|
233
|
+
]
|
234
|
+
results = @project.add_data_permissions(filters)
|
235
|
+
expect(results[:results].all? { |r| r[:status] == :successful }).to be_truthy
|
236
|
+
expect(results[:results].select {|r| r[:type] == :create }.count).to eq 1
|
237
|
+
expect(@project.data_permissions.count).to eq 1
|
238
|
+
end
|
239
|
+
|
240
|
+
it "should create a mandatory user filter with double filters" do
|
241
|
+
|
242
|
+
repo_label = @project.labels('some_attr_label_id')
|
243
|
+
metric = @project.create_metric("SELECT SUM(#\"Lines Changed\")")
|
244
|
+
|
245
|
+
# we want to compute stuff on different user than we are setting it on
|
246
|
+
u = @domain.users.find { |u| u.login != ConnectionHelper::DEFAULT_USERNAME }
|
247
|
+
password = 'abcd1234'
|
248
|
+
u.json['accountSetting']['password'] = password
|
249
|
+
@domain.update_user(u)
|
250
|
+
@project.add_user(u, 'admin')
|
251
|
+
|
252
|
+
computation_client = GoodData.connect(u.login, password, verify_ssl: false)
|
253
|
+
computation_project = computation_client.projects(@project.pid)
|
254
|
+
|
255
|
+
# verify we are set up
|
256
|
+
r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
|
257
|
+
expect(r.column(4)).to eq ["tomas@gooddata.com", 6, 1]
|
258
|
+
|
259
|
+
# lets restrict tomas to goodot only
|
260
|
+
filters = [[u.login, @label.uri, 'tomas@gooddata.com'],
|
261
|
+
[u.login, repo_label.uri, 'goodot']]
|
262
|
+
results = @project.add_data_permissions(filters)
|
263
|
+
expect(@project.data_permissions.pmap {|f| [f.related.login, f.pretty_expression]}).to eq [
|
264
|
+
[u.login, "[Dev] IN ([tomas@gooddata.com])"],
|
265
|
+
[u.login, "[Repository Name] IN ([goodot])"]]
|
266
|
+
|
267
|
+
r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
|
268
|
+
expect(r.column(2)).to eq ["tomas@gooddata.com", 1]
|
269
|
+
|
270
|
+
# Now lets change repo to bam
|
271
|
+
filters = [[u.login, @label.uri, 'tomas@gooddata.com'],
|
272
|
+
[u.login, repo_label.uri, 'bam']]
|
273
|
+
results = @project.add_data_permissions(filters)
|
274
|
+
|
275
|
+
expect(@project.data_permissions.pmap {|f| [f.related.login, f.pretty_expression]}).to eq [
|
276
|
+
[u.login, "[Dev] IN ([tomas@gooddata.com])"],
|
277
|
+
[u.login, "[Repository Name] IN ([bam])"]]
|
278
|
+
|
279
|
+
r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
|
280
|
+
expect(r.column(2)).to eq ["tomas@gooddata.com", 6]
|
281
|
+
|
282
|
+
# let's remove the repo restriction
|
283
|
+
filters = [[u.login, @label.uri, 'tomas@gooddata.com']]
|
284
|
+
results = @project.add_data_permissions(filters)
|
285
|
+
|
286
|
+
r = computation_project.compute_report(left: [metric, 'some_attr_label_id'], top: [@label])
|
287
|
+
expect(r.column(2)).to eq ["tomas@gooddata.com", 6, 1]
|
288
|
+
end
|
188
289
|
end
|
@@ -1,3 +1,9 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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
|
+
|
1
7
|
require 'gooddata'
|
2
8
|
|
3
9
|
describe "Variables implementation", :constraint => 'slow' do
|
@@ -100,20 +106,7 @@ describe "Variables implementation", :constraint => 'slow' do
|
|
100
106
|
expect(@variable.user_values.pmap {|m| m.pretty_expression}).to eq ["[Dev] IN ([jirka@gooddata.com])"]
|
101
107
|
expect(@variable.user_values.count).to eq 1
|
102
108
|
end
|
103
|
-
|
104
|
-
it "should be able to add mandatory filter to a user not in the project if domain is provided" do
|
105
|
-
domain = @client.domain(ConnectionHelper::DEFAULT_DOMAIN)
|
106
|
-
u = domain.users.find { |u| u.login != ConnectionHelper::DEFAULT_USERNAME }
|
107
|
-
filters = [[u.login, @label.uri, "tomas@gooddata.com"]]
|
108
|
-
expect do
|
109
|
-
@project.add_variable_permissions(filters, @variable)
|
110
|
-
end.to raise_error
|
111
|
-
@project.add_variable_permissions(filters, @variable, :domain => domain)
|
112
|
-
filters = @variable.user_values
|
113
|
-
expect(filters.first.related.login).to eq u.login
|
114
|
-
expect(filters.count).to eq 1
|
115
|
-
end
|
116
|
-
|
109
|
+
|
117
110
|
it "should be able to print data permissions in a human readable form" do
|
118
111
|
filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com"]]
|
119
112
|
@project.add_variable_permissions(filters, @variable)
|
@@ -183,7 +176,7 @@ describe "Variables implementation", :constraint => 'slow' do
|
|
183
176
|
end
|
184
177
|
|
185
178
|
it "should be able to update the filter value in place" do
|
186
|
-
|
179
|
+
skip('We cannot swap filters yet')
|
187
180
|
filters = [[ConnectionHelper::DEFAULT_USERNAME, @label.uri, "tomas@gooddata.com", "jirka@gooddata.com"]]
|
188
181
|
@project.add_variable_permissions(filters, @variable)
|
189
182
|
perm = @variable.user_values.first
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'gooddata'
|
4
8
|
require 'pry'
|
@@ -14,6 +18,48 @@ describe GoodData::Rest::Connection, :constraint => 'slow' do
|
|
14
18
|
client.disconnect
|
15
19
|
end
|
16
20
|
|
21
|
+
it 'should be able to log in with user name and password as params' do
|
22
|
+
client = GoodData.connect(GoodData::Environment::ConnectionHelper::DEFAULT_USERNAME, GoodData::Environment::ConnectionHelper::DEFAULT_PASSWORD,
|
23
|
+
server: GoodData::Environment::ConnectionHelper::DEFAULT_SERVER,
|
24
|
+
verify_ssl: false)
|
25
|
+
client.disconnect
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should be able to log in with user name and password as hash' do
|
29
|
+
client = GoodData.connect(username: GoodData::Environment::ConnectionHelper::DEFAULT_USERNAME,
|
30
|
+
password: GoodData::Environment::ConnectionHelper::DEFAULT_PASSWORD,
|
31
|
+
server: GoodData::Environment::ConnectionHelper::DEFAULT_SERVER,
|
32
|
+
verify_ssl: false)
|
33
|
+
client.disconnect
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should be able to log in with login and password as hash' do
|
37
|
+
client = GoodData.connect(login: GoodData::Environment::ConnectionHelper::DEFAULT_USERNAME,
|
38
|
+
password: GoodData::Environment::ConnectionHelper::DEFAULT_PASSWORD,
|
39
|
+
server: GoodData::Environment::ConnectionHelper::DEFAULT_SERVER,
|
40
|
+
verify_ssl: false)
|
41
|
+
client.disconnect
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should be able to pass additional params in hash' do
|
45
|
+
client = GoodData.connect(login: GoodData::Environment::ConnectionHelper::DEFAULT_USERNAME,
|
46
|
+
password: GoodData::Environment::ConnectionHelper::DEFAULT_PASSWORD,
|
47
|
+
server: GoodData::Environment::ConnectionHelper::DEFAULT_SERVER,
|
48
|
+
webdav_server: 'https://some_random_server/',
|
49
|
+
verify_ssl: false)
|
50
|
+
expect(client.opts[:webdav_server]).to eq 'https://some_random_server/'
|
51
|
+
client.disconnect
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should be able to pass additional params in hash when used login/pass' do
|
55
|
+
client = GoodData.connect(GoodData::Environment::ConnectionHelper::DEFAULT_USERNAME, GoodData::Environment::ConnectionHelper::DEFAULT_PASSWORD,
|
56
|
+
server: GoodData::Environment::ConnectionHelper::DEFAULT_SERVER,
|
57
|
+
webdav_server: 'https://some_random_server/',
|
58
|
+
verify_ssl: false)
|
59
|
+
expect(client.opts[:webdav_server]).to eq 'https://some_random_server/'
|
60
|
+
client.disconnect
|
61
|
+
end
|
62
|
+
|
17
63
|
it "should log in and disconnect with SST" do
|
18
64
|
regular_client = ConnectionHelper::create_default_connection
|
19
65
|
sst = regular_client.connection.sst_token
|
@@ -25,6 +71,18 @@ describe GoodData::Rest::Connection, :constraint => 'slow' do
|
|
25
71
|
regular_client.disconnect
|
26
72
|
end
|
27
73
|
|
74
|
+
it "should log in and disconnect with SST with additional params" do
|
75
|
+
regular_client = ConnectionHelper::create_default_connection
|
76
|
+
sst = regular_client.connection.sst_token
|
77
|
+
|
78
|
+
sst_client = GoodData.connect(sst_token: sst, verify_ssl: false, webdav_server: 'https://some_random_server/')
|
79
|
+
expect(sst_client.projects.count).to be > 0
|
80
|
+
expect(sst_client.opts[:webdav_server]).to eq 'https://some_random_server/'
|
81
|
+
sst_client.disconnect
|
82
|
+
|
83
|
+
regular_client.disconnect
|
84
|
+
end
|
85
|
+
|
28
86
|
it "should be able to regenerate TT" do
|
29
87
|
regular_client = ConnectionHelper::create_default_connection
|
30
88
|
projects = regular_client.projects
|
data/spec/spec_helper.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'simplecov'
|
4
8
|
require 'pmap'
|
5
9
|
require 'rspec'
|
6
|
-
require 'coveralls'
|
7
10
|
require 'pathname'
|
8
11
|
require 'webmock/rspec'
|
9
12
|
|
10
13
|
WebMock.disable!
|
11
|
-
Coveralls.wear_merged!
|
12
14
|
|
13
15
|
# Automagically include all helpers/*_helper.rb
|
14
16
|
|
@@ -23,7 +25,11 @@ end
|
|
23
25
|
|
24
26
|
include GoodData::Helpers
|
25
27
|
|
28
|
+
RSpec::Expectations.configuration.warn_about_potential_false_positives = false
|
29
|
+
|
26
30
|
RSpec.configure do |config|
|
31
|
+
config.deprecation_stream = File.open('deprecations.txt', 'w')
|
32
|
+
|
27
33
|
config.include BlueprintHelper
|
28
34
|
config.include CliHelper
|
29
35
|
config.include ConnectionHelper
|
@@ -57,7 +63,7 @@ RSpec.configure do |config|
|
|
57
63
|
|
58
64
|
config.before(:suite) do
|
59
65
|
# TODO: Setup test project
|
60
|
-
GoodData.
|
66
|
+
GoodData.logging_off
|
61
67
|
end
|
62
68
|
|
63
69
|
config.after(:suite) do
|
@@ -66,8 +72,7 @@ RSpec.configure do |config|
|
|
66
72
|
end
|
67
73
|
|
68
74
|
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
69
|
-
SimpleCov::Formatter::HTMLFormatter
|
70
|
-
Coveralls::SimpleCov::Formatter
|
75
|
+
SimpleCov::Formatter::HTMLFormatter
|
71
76
|
]
|
72
77
|
|
73
78
|
SimpleCov.start do
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'gooddata/bricks/brick'
|
4
8
|
require 'gooddata/bricks/bricks'
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'gooddata/bricks/brick'
|
4
8
|
require 'gooddata/bricks/bricks'
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'gooddata/bricks/brick'
|
4
8
|
require 'gooddata/bricks/bricks'
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'gooddata/bricks/brick'
|
4
8
|
require 'gooddata/bricks/bricks'
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'gooddata/bricks/brick'
|
4
8
|
require 'gooddata/bricks/bricks'
|
@@ -1,4 +1,8 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010-2015 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.
|
2
6
|
|
3
7
|
require 'gooddata/bricks/brick'
|
4
8
|
require 'gooddata/bricks/bricks'
|