gooddata 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. checksums.yaml +4 -4
  2. data/.document +0 -0
  3. data/.flayignore +2 -0
  4. data/.travis.yml +24 -7
  5. data/.yardopts +0 -0
  6. data/CHANGELOG.md +125 -1
  7. data/CLI.md +0 -0
  8. data/Dockerfile.jruby +7 -2
  9. data/Dockerfile.ruby +1 -1
  10. data/Gemfile +0 -0
  11. data/Guardfile +0 -0
  12. data/Rakefile +23 -9
  13. data/TODO.md +0 -0
  14. data/bin/gitflow-init.sh +8 -0
  15. data/ci.rake +3 -3
  16. data/data/2008.crt +39 -0
  17. data/data/new_ca.cer +22 -0
  18. data/dependency_decisions.yml +0 -0
  19. data/docker-compose.lcm.yml +31 -0
  20. data/docker-compose.yml +4 -2
  21. data/gooddata.gemspec +3 -3
  22. data/lcm.rake +288 -0
  23. data/lib/gooddata.rb +1 -0
  24. data/lib/gooddata/bricks/base_downloader.rb +1 -1
  25. data/lib/gooddata/bricks/brick.rb +0 -1
  26. data/lib/gooddata/bricks/middleware/aws_middleware.rb +1 -1
  27. data/lib/gooddata/bricks/middleware/logger_middleware.rb +1 -1
  28. data/lib/gooddata/bricks/pipeline.rb +67 -0
  29. data/lib/gooddata/bricks/provisioning_brick.rb +18 -0
  30. data/lib/gooddata/bricks/release_brick.rb +18 -0
  31. data/lib/gooddata/bricks/rollout_brick.rb +14 -0
  32. data/lib/gooddata/bricks/user_filters_brick.rb +13 -0
  33. data/lib/gooddata/bricks/users_brick.rb +13 -0
  34. data/lib/gooddata/core/logging.rb +1 -1
  35. data/lib/gooddata/exceptions/maql_execution.rb +1 -1
  36. data/lib/gooddata/extensions/string.rb +0 -0
  37. data/lib/gooddata/lcm/actions/associate_clients.rb +34 -8
  38. data/lib/gooddata/lcm/actions/collect_data_product.rb +8 -1
  39. data/lib/gooddata/lcm/actions/collect_segment_clients.rb +13 -23
  40. data/lib/gooddata/lcm/actions/collect_segments.rb +10 -0
  41. data/lib/gooddata/lcm/actions/synchronize_clients.rb +3 -1
  42. data/lib/gooddata/lcm/actions/synchronize_ldm.rb +61 -34
  43. data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +6 -4
  44. data/lib/gooddata/lcm/actions/update_release_table.rb +4 -12
  45. data/lib/gooddata/lcm/dsl/params_dsl.rb +0 -4
  46. data/lib/gooddata/lcm/dsl/type_dsl.rb +0 -4
  47. data/lib/gooddata/lcm/helpers/check_helper.rb +1 -1
  48. data/lib/gooddata/lcm/lcm2.rb +0 -2
  49. data/lib/gooddata/lcm/types/special/enum.rb +6 -0
  50. data/lib/gooddata/lcm/types/special/enum/synchronize_ldm.rb +20 -0
  51. data/lib/gooddata/lcm/types/special/types.rb +1 -1
  52. data/lib/gooddata/mixins/is_folder.rb +0 -0
  53. data/lib/gooddata/mixins/to_json.rb +0 -0
  54. data/lib/gooddata/mixins/uri_getter.rb +0 -0
  55. data/lib/gooddata/models/project_creator.rb +38 -30
  56. data/lib/gooddata/models/user_filters/user_filter_builder.rb +1 -0
  57. data/lib/gooddata/rest/README.md +0 -0
  58. data/lib/gooddata/version.rb +1 -1
  59. data/lib/templates/bricks/brick.rb.erb +0 -0
  60. data/lib/templates/bricks/main.rb.erb +0 -0
  61. data/lib/templates/project/Goodfile.erb +0 -0
  62. data/lib/templates/project/data/commits.csv +0 -0
  63. data/lib/templates/project/data/devs.csv +0 -0
  64. data/lib/templates/project/data/repos.csv +0 -0
  65. data/lib/templates/project/model/model.rb.erb +0 -0
  66. metadata +21 -451
  67. data/lib/gooddata/lcm/actions/ensure_data_product.rb +0 -63
  68. data/spec/.rubocop.yml +0 -16
  69. data/spec/bricks/bricks_spec.rb +0 -110
  70. data/spec/bricks/default-config.json +0 -8
  71. data/spec/data/.gooddata +0 -4
  72. data/spec/data/blueprints/additional_dataset_module.json +0 -32
  73. data/spec/data/blueprints/attribute_sort_order_blueprint.json +0 -72
  74. data/spec/data/blueprints/big_blueprint_not_pruned.json +0 -2079
  75. data/spec/data/blueprints/invalid_blueprint.json +0 -103
  76. data/spec/data/blueprints/m_n_model.json +0 -104
  77. data/spec/data/blueprints/model_module.json +0 -25
  78. data/spec/data/blueprints/test_blueprint.json +0 -39
  79. data/spec/data/blueprints/test_project_model_spec.json +0 -106
  80. data/spec/data/cc/data/source/commits.csv +0 -4
  81. data/spec/data/cc/data/source/devs.csv +0 -4
  82. data/spec/data/cc/data/source/repos.csv +0 -3
  83. data/spec/data/cc/devel.prm +0 -0
  84. data/spec/data/cc/graph/graph.grf +0 -11
  85. data/spec/data/cc/workspace.prm +0 -19
  86. data/spec/data/column_based_permissions.csv +0 -7
  87. data/spec/data/column_based_permissions2.csv +0 -6
  88. data/spec/data/dynamic_schedule_params_table.csv +0 -7
  89. data/spec/data/gd_gse_data_blueprint.json +0 -1371
  90. data/spec/data/gd_gse_data_manifest.json +0 -1424
  91. data/spec/data/gd_gse_data_model.json +0 -1772
  92. data/spec/data/gooddata_version_process/gooddata_version.rb +0 -9
  93. data/spec/data/gooddata_version_process/gooddata_version.zip +0 -0
  94. data/spec/data/hello_world_process/hello_world.rb +0 -9
  95. data/spec/data/hello_world_process/hello_world.zip +0 -0
  96. data/spec/data/integration_model.json +0 -252
  97. data/spec/data/integration_policies.csv +0 -9134
  98. data/spec/data/line_based_permissions.csv +0 -3
  99. data/spec/data/manifests/test_blueprint.json +0 -32
  100. data/spec/data/manifests/test_project.json +0 -107
  101. data/spec/data/reports/left_attr_report.json +0 -108
  102. data/spec/data/reports/metric_only_one_line.json +0 -83
  103. data/spec/data/reports/report_1.json +0 -197
  104. data/spec/data/reports/top_attr_report.json +0 -108
  105. data/spec/data/ruby_params_process/ruby_params.rb +0 -9
  106. data/spec/data/ruby_process/deep_files/deep_stuff.txt +0 -1
  107. data/spec/data/ruby_process/process.rb +0 -8
  108. data/spec/data/ruby_process/stuff.txt +0 -1
  109. data/spec/data/superfluous_titles_view.json +0 -81
  110. data/spec/data/test-ci-data.csv +0 -2
  111. data/spec/data/user_filters.csv +0 -2
  112. data/spec/data/users.csv +0 -12
  113. data/spec/data/wire_models/attribute_sort_by_model.json +0 -73
  114. data/spec/data/wire_models/model_view.json +0 -1775
  115. data/spec/data/wire_models/nu_model.json +0 -3046
  116. data/spec/data/wire_models/test_blueprint.json +0 -66
  117. data/spec/data/wire_test_project.json +0 -150
  118. data/spec/data/workspace_table.csv +0 -3
  119. data/spec/environment/default.rb +0 -43
  120. data/spec/environment/development.rb +0 -32
  121. data/spec/environment/environment.rb +0 -38
  122. data/spec/environment/production.rb +0 -27
  123. data/spec/environment/staging.rb +0 -32
  124. data/spec/environment/testing.rb +0 -32
  125. data/spec/helpers/appstore_project_helper.rb +0 -221
  126. data/spec/helpers/blueprint_helper.rb +0 -27
  127. data/spec/helpers/cli_helper.rb +0 -38
  128. data/spec/helpers/connection_helper.rb +0 -43
  129. data/spec/helpers/constants.rb +0 -32
  130. data/spec/helpers/crypto_helper.rb +0 -19
  131. data/spec/helpers/csv_helper.rb +0 -20
  132. data/spec/helpers/process_helper.rb +0 -35
  133. data/spec/helpers/project_helper.rb +0 -74
  134. data/spec/helpers/schedule_helper.rb +0 -33
  135. data/spec/helpers/spec_helper.rb +0 -17
  136. data/spec/integration/ads_output_stage_spec.rb +0 -45
  137. data/spec/integration/blueprint_updates_spec.rb +0 -107
  138. data/spec/integration/blueprint_with_ca_spec.rb +0 -56
  139. data/spec/integration/blueprint_with_grain_spec.rb +0 -74
  140. data/spec/integration/channel_configuration_spec.rb +0 -67
  141. data/spec/integration/clients_spec.rb +0 -164
  142. data/spec/integration/command_datawarehouse_spec.rb +0 -45
  143. data/spec/integration/command_projects_spec.rb +0 -32
  144. data/spec/integration/commands/command_projects_spec.rb +0 -22
  145. data/spec/integration/connection_spec.rb +0 -37
  146. data/spec/integration/core/connection_spec.rb +0 -56
  147. data/spec/integration/core/logging_spec.rb +0 -132
  148. data/spec/integration/core/project_spec.rb +0 -54
  149. data/spec/integration/create_from_template_spec.rb +0 -29
  150. data/spec/integration/create_project_spec.rb +0 -27
  151. data/spec/integration/date_dim_switch_spec.rb +0 -154
  152. data/spec/integration/deprecated_load_spec.rb +0 -60
  153. data/spec/integration/full_process_schedule_spec.rb +0 -367
  154. data/spec/integration/full_project_spec.rb +0 -592
  155. data/spec/integration/helpers_spec.rb +0 -16
  156. data/spec/integration/lcm_spec.rb +0 -54
  157. data/spec/integration/mandatory_user_filter_spec.rb +0 -53
  158. data/spec/integration/mixins/id_to_uri_spec.rb +0 -56
  159. data/spec/integration/models/data_product_spec.rb +0 -71
  160. data/spec/integration/models/domain_spec.rb +0 -162
  161. data/spec/integration/models/invitation_spec.rb +0 -17
  162. data/spec/integration/models/label_spec.rb +0 -49
  163. data/spec/integration/models/membership_spec.rb +0 -127
  164. data/spec/integration/models/metadata/report_spec.rb +0 -54
  165. data/spec/integration/models/metric_spec.rb +0 -24
  166. data/spec/integration/models/params_spec.rb +0 -118
  167. data/spec/integration/models/process_spec.rb +0 -35
  168. data/spec/integration/models/profile_spec.rb +0 -210
  169. data/spec/integration/models/project_role_spec.rb +0 -94
  170. data/spec/integration/models/project_spec.rb +0 -225
  171. data/spec/integration/models/schedule_spec.rb +0 -477
  172. data/spec/integration/models/unit_project_spec.rb +0 -130
  173. data/spec/integration/over_to_user_filters_spec.rb +0 -98
  174. data/spec/integration/partial_md_export_import_spec.rb +0 -41
  175. data/spec/integration/project_spec.rb +0 -381
  176. data/spec/integration/rest_spec.rb +0 -214
  177. data/spec/integration/schedule_spec.rb +0 -611
  178. data/spec/integration/segments_spec.rb +0 -100
  179. data/spec/integration/subscription_spec.rb +0 -88
  180. data/spec/integration/urn_date_dim_spec.rb +0 -53
  181. data/spec/integration/user_filters_spec.rb +0 -310
  182. data/spec/integration/user_group_spec.rb +0 -147
  183. data/spec/integration/variables_spec.rb +0 -189
  184. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/can_assign_a_custom_logger.yml +0 -2287
  185. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/client_logs_when_given_custom_message.yml +0 -2287
  186. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logger/has_the_request_id_logged_when_I_passed_it.yml +0 -2287
  187. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_off/Disables_logging.yml +0 -2287
  188. data/spec/integration/vcr_cassettes/GoodData_-_logging/_logging_on/Enables_logging.yml +0 -2287
  189. data/spec/integration/vcr_cassettes/GoodData_-_project/_project/Returns_project_assigned.yml +0 -354
  190. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_nil.yml +0 -299
  191. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_directly.yml +0 -354
  192. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_ID.yml +0 -354
  193. data/spec/integration/vcr_cassettes/GoodData_-_project/_project_/Assigns_project_using_project_URL.yml +0 -354
  194. data/spec/integration/vcr_cassettes/GoodData_-_project/_with_project/Uses_project_specified.yml +0 -354
  195. data/spec/integration/vcr_cassettes/GoodData_Metric/all.yml +0 -2065
  196. data/spec/integration/vcr_cassettes/GoodData_Metric/should_be_able_to_update_folders.yml +0 -119
  197. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/all.yml +0 -9812
  198. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_get_json_containing_correct_id.yml +0 -174
  199. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_return_nil_for_unknown_id.yml +0 -58
  200. data/spec/integration/vcr_cassettes/GoodData_Mixin_MdIdToUri/should_throw_BadRequest_for_-1.yml +0 -63
  201. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_connect/Connects_using_username_and_password.yml +0 -299
  202. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_disconnect/Connects_using_username_and_password.yml +0 -299
  203. data/spec/integration/vcr_cassettes/GoodData_Rest_Connection/_generate_request_id/Generates_a_non-empty_string.yml +0 -2287
  204. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_/Should_list_user_groups_as_Array.yml +0 -56
  205. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_add_members/Should_add_member.yml +0 -315
  206. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_members/Should_return_members_as_array.yml +0 -54
  207. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_remove_members/Should_remove_existing_members.yml +0 -258
  208. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_save/updates_existing_group.yml +0 -159
  209. data/spec/integration/vcr_cassettes/GoodData_UserGroup/_set_members/Should_set_new_members.yml +0 -158
  210. data/spec/integration/vcr_cassettes/GoodData_UserGroup/all.yml +0 -809
  211. data/spec/logging_in_logging_out_spec.rb +0 -91
  212. data/spec/spec_helper.rb +0 -110
  213. data/spec/unit/actions/associate_clients_spec.rb +0 -48
  214. data/spec/unit/actions/collect_client_projects_spec.rb +0 -47
  215. data/spec/unit/actions/collect_clients_spec.rb +0 -65
  216. data/spec/unit/actions/collect_data_product_spec.rb +0 -58
  217. data/spec/unit/actions/collect_dynamic_schedule_params_spec.rb +0 -56
  218. data/spec/unit/actions/collect_meta_spec.rb +0 -88
  219. data/spec/unit/actions/collect_segment_clients_spec.rb +0 -82
  220. data/spec/unit/actions/collect_tagged_objects_spec.rb +0 -126
  221. data/spec/unit/actions/collect_users_brick_users_spec.rb +0 -36
  222. data/spec/unit/actions/create_segment_masters_spec.rb +0 -65
  223. data/spec/unit/actions/ensure_data_product_spec.rb +0 -39
  224. data/spec/unit/actions/ensure_technical_users_domain_spec.rb +0 -53
  225. data/spec/unit/actions/ensure_technical_users_project_spec.rb +0 -76
  226. data/spec/unit/actions/execute_schedules_spec.rb +0 -94
  227. data/spec/unit/actions/provision_clients_spec.rb +0 -46
  228. data/spec/unit/actions/purge_clients_spec.rb +0 -47
  229. data/spec/unit/actions/rename_existing_client_projects_spec.rb +0 -54
  230. data/spec/unit/actions/segments_filter_spec.rb +0 -46
  231. data/spec/unit/actions/shared_examples_for_user_actions.rb +0 -43
  232. data/spec/unit/actions/synchronize_cas_spec.rb +0 -58
  233. data/spec/unit/actions/synchronize_clients_spec.rb +0 -71
  234. data/spec/unit/actions/synchronize_etls_in_segment_spec.rb +0 -206
  235. data/spec/unit/actions/synchronize_ldm_spec.rb +0 -70
  236. data/spec/unit/actions/synchronize_user_filters_spec.rb +0 -208
  237. data/spec/unit/actions/synchronize_user_groups_spec.rb +0 -49
  238. data/spec/unit/actions/synchronize_users_spec.rb +0 -180
  239. data/spec/unit/bricks/bricks_spec.rb +0 -34
  240. data/spec/unit/bricks/middleware/aws_middelware_spec.rb +0 -98
  241. data/spec/unit/bricks/middleware/bench_middleware_spec.rb +0 -15
  242. data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +0 -15
  243. data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +0 -15
  244. data/spec/unit/bricks/middleware/logger_middleware_spec.rb +0 -30
  245. data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +0 -15
  246. data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +0 -15
  247. data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +0 -15
  248. data/spec/unit/cli/cli_spec.rb +0 -17
  249. data/spec/unit/cli/commands/cmd_auth_spec.rb +0 -17
  250. data/spec/unit/core/nil_logger_spec.rb +0 -13
  251. data/spec/unit/extensions/hash_spec.rb +0 -22
  252. data/spec/unit/godzilla/goodzilla_spec.rb +0 -74
  253. data/spec/unit/helpers/check_helper_production_spec.rb +0 -34
  254. data/spec/unit/helpers/check_helper_spec.rb +0 -134
  255. data/spec/unit/helpers/csv_helper_spec.rb +0 -22
  256. data/spec/unit/helpers/data_helper_spec.rb +0 -67
  257. data/spec/unit/helpers/global_helpers_spec.rb +0 -264
  258. data/spec/unit/helpers_spec.rb +0 -254
  259. data/spec/unit/lcm/lcm2_spec.rb +0 -100
  260. data/spec/unit/lcm/user_bricks_helper_spec.rb +0 -58
  261. data/spec/unit/models/blueprint/attribute_sort_by_spec.rb +0 -20
  262. data/spec/unit/models/blueprint/attributes_spec.rb +0 -28
  263. data/spec/unit/models/blueprint/dataset_spec.rb +0 -120
  264. data/spec/unit/models/blueprint/label_blueprint_field_spec.rb +0 -43
  265. data/spec/unit/models/blueprint/project_blueprint_spec.rb +0 -642
  266. data/spec/unit/models/blueprint/reference_spec.rb +0 -28
  267. data/spec/unit/models/blueprint/schema_builder_spec.rb +0 -36
  268. data/spec/unit/models/blueprint/to_wire_spec.rb +0 -196
  269. data/spec/unit/models/dataset_blueprint.rb +0 -14
  270. data/spec/unit/models/execution_spec.rb +0 -109
  271. data/spec/unit/models/from_wire_spec.rb +0 -321
  272. data/spec/unit/models/metadata_spec.rb +0 -140
  273. data/spec/unit/models/metric_spec.rb +0 -129
  274. data/spec/unit/models/model_spec.rb +0 -87
  275. data/spec/unit/models/project_creator_spec.rb +0 -90
  276. data/spec/unit/models/project_spec.rb +0 -94
  277. data/spec/unit/models/report_result_data_spec.rb +0 -194
  278. data/spec/unit/models/to_manifest_spec.rb +0 -165
  279. data/spec/unit/models/user_filters/user_filter_builder_spec.rb +0 -149
  280. data/spec/unit/models/user_filters_spec.rb +0 -95
  281. data/spec/unit/models/variable_spec.rb +0 -280
  282. data/spec/unit/rest/phmap_spec.rb +0 -117
  283. data/spec/unit/rest/polling_spec.rb +0 -101
  284. data/spec/unit/rest/resource_spec.rb +0 -10
  285. data/spec/vcr_configurer.rb +0 -63
@@ -1,254 +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/client'
8
- require 'gooddata/models/model'
9
-
10
- describe GoodData::Helpers do
11
- describe '#home_directory' do
12
- it 'works' do
13
- GoodData::Helpers.home_directory
14
- end
15
- end
16
-
17
- describe '#running_on_windows?' do
18
- it 'works' do
19
- result = GoodData::Helpers.running_on_windows?
20
- # rubocop:disable Style/DoubleNegation
21
- !!result.should == result
22
- # rubocop:enable Style/DoubleNegation
23
- end
24
- end
25
-
26
- describe '#running_on_mac?' do
27
- it 'works' do
28
- result = GoodData::Helpers.running_on_a_mac?
29
- # rubocop:disable Style/DoubleNegation
30
- !!result.should == result
31
- # rubocop:enable Style/DoubleNegation
32
- end
33
- end
34
-
35
- describe '#error' do
36
- it 'works' do
37
- expect { GoodData::Helpers.error('Test Error') }.to raise_error(SystemExit)
38
- end
39
- end
40
-
41
- describe "#decode_params" do
42
- it 'decodes the data params from json' do
43
- params = {
44
- 'param' => 'value',
45
- 'number_param' => 5,
46
- 'gd_encoded_params' => '{"deep": {"deeper": "deep value"}}'
47
- }
48
- expected_result = {
49
- 'param' => 'value',
50
- 'number_param' => 5,
51
- 'deep' => {
52
- 'deeper' => 'deep value'
53
- }
54
- }
55
- result = GoodData::Helpers.decode_params(params)
56
- expect(result).to eq(expected_result)
57
- end
58
-
59
- it 'should not show reference parameter values when get error' do
60
- params = {
61
- 'secret' => 'you will not see it',
62
- 'gd_encoded_params' => "{\"abc\": \"${secret}\",}"
63
- }
64
- expect { GoodData::Helpers.decode_params(params, resolve_reference_params: true) }.to raise_error do |e|
65
- expect(e.message).not_to include('you will not see it')
66
- end
67
- end
68
-
69
- it 'ignore value of encoded params if its value is not collection or String when resolve reference params' do
70
- params = {
71
- 'param' => 'value',
72
- 'number_param' => 5,
73
- 'gd_encoded_params' => { "deep" => { "deeper" => "deep value" }, "bool" => true, "int" => 1 }
74
- }
75
- expected_result = {
76
- 'param' => 'value',
77
- 'number_param' => 5,
78
- 'deep' => {
79
- 'deeper' => 'deep value'
80
- },
81
- "bool" => true,
82
- "int" => 1
83
- }
84
- result = GoodData::Helpers.decode_params(params, resolve_reference_params: true)
85
- expect(result).to eq(expected_result)
86
- end
87
-
88
- it 'decodes the hidden_data in hidden params' do
89
- params = {
90
- 'param' => 'value',
91
- 'number_param' => 5,
92
- 'gd_encoded_hidden_params' => '{"deep_secret": {"deeper_secret": "hidden value"}}'
93
- }
94
- expected_result = {
95
- 'param' => 'value',
96
- 'number_param' => 5,
97
- "gd_encoded_hidden_params" => nil,
98
- "deep_secret" => {
99
- "deeper_secret" => "hidden value"
100
- }
101
- }
102
- result = GoodData::Helpers.decode_params(params)
103
- expect(result).to eq(expected_result)
104
- end
105
-
106
- it 'decodes the reference parameters in gd_encoded_params in String form' do
107
- params = {
108
- 'param' => 'value',
109
- 'number_param' => 5,
110
- 'ads_password' => 'ads_123',
111
- 'my_password' => 'login_123',
112
- 'gd_encoded_params' => '{"login_username": "login_user", "login_password": "${my_password}", "data01": "\\\\${my_password}", "data02":"abc\\\\def"}'
113
- }
114
- expected_result = {
115
- 'param' => 'value',
116
- 'number_param' => 5,
117
- 'ads_password' => 'ads_123',
118
- 'my_password' => 'login_123',
119
- 'login_username' => 'login_user',
120
- 'login_password' => 'login_123',
121
- 'data01' => '\\login_123',
122
- 'data02' => 'abc\\def'
123
- }
124
- result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
125
- expect(result).to eq(expected_result)
126
- end
127
-
128
- it 'decodes the reference parameters in gd_encoded_params in Hash form' do
129
- params = {
130
- 'param' => 'value',
131
- 'number_param' => 5,
132
- 'ads_password' => 'ads_123',
133
- 'my_password' => 'login_123',
134
- 'gd_encoded_params' => { "login_username" => "login_user", "login_password" => "${my_password}", "data01" => "\\\\${my_password}", "data02" => "abc\\def" }
135
- }
136
- expected_result = {
137
- 'param' => 'value',
138
- 'number_param' => 5,
139
- 'ads_password' => 'ads_123',
140
- 'my_password' => 'login_123',
141
- 'login_username' => 'login_user',
142
- 'login_password' => 'login_123',
143
- 'data01' => '\\login_123',
144
- 'data02' => 'abc\\def'
145
- }
146
- result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
147
- expect(result).to eq(expected_result)
148
- end
149
-
150
- it 'decodes escape the reference parameters in gd_encoded_params in String form' do
151
- params = {
152
- 'param' => 'value',
153
- 'number_param' => 5,
154
- 'ads_password' => 'ads_123',
155
- 'my_password' => 'login_123',
156
- 'gd_encoded_params' => '{"login_username": "login_user", "data01": "\\${abc}"}'
157
- }
158
- expected_result = {
159
- 'param' => 'value',
160
- 'number_param' => 5,
161
- 'ads_password' => 'ads_123',
162
- 'my_password' => 'login_123',
163
- 'login_username' => 'login_user',
164
- 'data01' => '${abc}'
165
- }
166
- result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
167
- expect(result).to eq(expected_result)
168
- end
169
-
170
- it 'decodes escape the reference parameters in gd_encoded_params in Hash form' do
171
- params = {
172
- 'param' => 'value',
173
- 'number_param' => 5,
174
- 'ads_password' => 'ads_123',
175
- 'my_password' => 'login_123',
176
- 'gd_encoded_params' => { "login_username" => "login_user", "data01" => "\\${abc}" }
177
- }
178
- expected_result = {
179
- 'param' => 'value',
180
- 'number_param' => 5,
181
- 'ads_password' => 'ads_123',
182
- 'my_password' => 'login_123',
183
- 'login_username' => 'login_user',
184
- 'data01' => '${abc}'
185
- }
186
- result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
187
- expect(result).to eq(expected_result)
188
- end
189
-
190
- it 'decodes the reference parameters in nested block in gd_encoded_params in String form' do
191
- params = {
192
- 'param' => 'value',
193
- 'number_param' => 5,
194
- 'ads_password' => 'ads_123',
195
- 'my_password' => 'login_123',
196
- 'gd_encoded_params' => '{"login_username": "login_user", "login_password": "${my_password}", "ads_client": {"username": "ads_user", "password": "${ads_password}"}}'
197
- }
198
- expected_result = {
199
- 'param' => 'value',
200
- 'number_param' => 5,
201
- 'ads_password' => 'ads_123',
202
- 'my_password' => 'login_123',
203
- 'login_username' => 'login_user',
204
- 'login_password' => 'login_123',
205
- 'ads_client' => {
206
- 'username' => 'ads_user',
207
- 'password' => 'ads_123'
208
- }
209
- }
210
- result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
211
- expect(result).to eq(expected_result)
212
- end
213
-
214
- it 'decodes the reference parameters in nested block in gd_encoded_params in Hash form' do
215
- params = {
216
- 'param' => 'value',
217
- 'number_param' => 5,
218
- 'ads_password' => 'ads_123',
219
- 'my_password' => 'login_123',
220
- 'gd_encoded_params' => {
221
- "login_username" => "login_user",
222
- "login_password" => "${my_password}",
223
- "ads_client" => {
224
- "username" => "ads_user",
225
- "password" => "${ads_password}"
226
- }
227
- }
228
- }
229
- expected_result = {
230
- 'param' => 'value',
231
- 'number_param' => 5,
232
- 'ads_password' => 'ads_123',
233
- 'my_password' => 'login_123',
234
- 'login_username' => 'login_user',
235
- 'login_password' => 'login_123',
236
- 'ads_client' => {
237
- 'username' => 'ads_user',
238
- 'password' => 'ads_123'
239
- }
240
- }
241
- result = GoodData::Helpers.decode_params(params, :resolve_reference_params => true)
242
- expect(result).to eq(expected_result)
243
- end
244
-
245
- it 'throws an error when data params is not a valid json' do
246
- params = {
247
- 'param' => 'value',
248
- 'number_param' => 5,
249
- 'gd_encoded_params' => 'This is no json.'
250
- }
251
- expect { GoodData::Helpers.decode_params(params) }.to raise_error(JSON::ParserError)
252
- end
253
- end
254
- end
@@ -1,100 +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/lcm/lcm2'
8
-
9
- shared_examples 'a smart hash' do
10
- let(:expected_value) { 'bar' }
11
- it 'fetches value' do
12
- expect(subject.FOO).to eq(expected_value)
13
- expect(subject.foo).to eq(expected_value)
14
- expect(subject['FOO']).to eq(expected_value)
15
- expect(subject['foo']).to eq(expected_value)
16
- expect(subject[:FOO]).to eq(expected_value)
17
- expect(subject[:foo]).to eq(expected_value)
18
- end
19
- end
20
-
21
- describe 'GoodData::LCM2' do
22
- describe '#skip_actions' do
23
- let(:client) { double(:client) }
24
- let(:domain) { 'domain' }
25
- let(:logger) { GoodData.logger }
26
- let(:params) do
27
- params = {
28
- skip_actions: %w(CollectSegments SynchronizeUsers),
29
- GDC_GD_CLIENT: client,
30
- GDC_LOGGER: logger,
31
- domain: domain
32
- }
33
- GoodData::LCM2.convert_to_smart_hash(params)
34
- end
35
-
36
- before do
37
- allow(client).to receive(:class) { GoodData::Rest::Client }
38
- allow(client).to receive(:domain) { domain }
39
- allow(logger).to receive(:info)
40
- allow(domain).to receive(:data_products)
41
- end
42
-
43
- it 'skips actions in skip_actions' do
44
- expect(GoodData::LCM2::CollectSegments).not_to receive(:call)
45
- expect(GoodData::LCM2::SynchronizeUsers).not_to receive(:call)
46
- GoodData::LCM2.perform('users', params)
47
- end
48
- end
49
-
50
- describe '#convert_to_smart_hash' do
51
- subject do
52
- GoodData::LCM2.convert_to_smart_hash(hash)
53
- end
54
-
55
- let(:hash) { { fooBarBaz: 'qUx' } }
56
-
57
- it 'keeps letter case' do
58
- expect(subject.to_h).to eq(hash)
59
- end
60
-
61
- context 'when hash contains symbol key in lower-case' do
62
- it_behaves_like 'a smart hash' do
63
- let(:hash) { { foo: 'bar' } }
64
- end
65
- end
66
-
67
- context 'when hash contains string key in lower-case' do
68
- it_behaves_like 'a smart hash' do
69
- let(:hash) { { 'foo' => 'bar' } }
70
- end
71
- end
72
-
73
- context 'when hash contains symbol key in upper-case' do
74
- it_behaves_like 'a smart hash' do
75
- let(:hash) { { FOO: 'bar' } }
76
- end
77
- end
78
-
79
- context 'when hash contains string key in upper-case' do
80
- it_behaves_like 'a smart hash' do
81
- let(:hash) { { 'FOO' => 'bar' } }
82
- end
83
- end
84
- end
85
-
86
- describe '#run_action' do
87
- let(:params) { double('params') }
88
- let(:logger) { GoodData.logger }
89
- it 'runs the action' do
90
- expect(params).to receive(:clear_filters).exactly(2).times
91
- expect(params).to receive(:segments_filter)
92
- expect(params).to receive(:data_product)
93
- expect(params).to receive(:gdc_logger) { logger }
94
- expect(params).to receive(:setup_filters)
95
-
96
- expect(GoodData::LCM2::CollectSegments).to receive(:call)
97
- GoodData::LCM2.run_action(GoodData::LCM2::CollectSegments, params)
98
- end
99
- end
100
- end
@@ -1,58 +0,0 @@
1
- describe GoodData::LCM2::UserBricksHelper do
2
- subject { GoodData::LCM2::UserBricksHelper.resolve_client_id(domain, project, data_product) }
3
- let(:domain) { double('domain') }
4
- let(:project) { double('project') }
5
- let(:data_product) { double('data_product') }
6
- let(:project_uri) { '/gdc/projects/fooooo' }
7
- let(:clients) { [client] }
8
- let(:client) { double('client') }
9
- let(:client_id) { 'bar' }
10
- let(:project_id) { 'baz' }
11
-
12
- before do
13
- allow(project).to receive(:metadata).and_return(metadata)
14
- allow(project).to receive(:uri).and_return(project_uri)
15
- allow(domain).to receive(:clients).and_return(clients)
16
- allow(client).to receive(:project_uri).and_return(project_uri)
17
- allow(client).to receive(:id).and_return(client_id)
18
- allow(project).to receive(:id).and_return(project_id)
19
- allow(project).to receive(:pid).and_return(project_id)
20
- end
21
- shared_examples_for 'a client id resolver' do
22
- context 'when client matches specified project url' do
23
- it 'returns client id' do
24
- expect(subject).to eq(client_id)
25
- end
26
- end
27
- end
28
-
29
- describe '.resolve_client_id' do
30
- context 'when GOODOT_CUSTOM_PROJECT_ID specified' do
31
- let(:metadata) { { 'GOODOT_CUSTOM_PROJECT_ID' => client_id } }
32
- it_behaves_like 'a client id resolver'
33
-
34
- context 'when goodot id does not match client id' do
35
- before { allow(client).to receive(:id).and_return('different_id') }
36
- it 'raises an error' do
37
- expect { subject }.to raise_error(/doesn't match client id/)
38
- end
39
- end
40
- end
41
-
42
- context 'when GOODOT_CUSTOM_PROJECT_ID not specified' do
43
- let(:metadata) { { 'GOODOT_CUSTOM_PROJECT_ID' => nil } }
44
- it_behaves_like 'a client id resolver'
45
-
46
- context 'when no client matches project url' do
47
- before do
48
- allow(client).to receive(:project_uri).and_return('different/uri')
49
- end
50
-
51
- it 'raises an error' do
52
- expected = /does not contain key GOODOT_CUSTOM_PROJECT_ID/
53
- expect { subject }.to raise_error(expected)
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,20 +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::Model::AttributeBlueprintField do
10
- before(:each) do
11
- @model_view = MultiJson.load(File.read('./spec/data/wire_models/attribute_sort_by_model.json'))
12
- @blueprint = GoodData::Model::FromWire.from_wire(@model_view)
13
- @dataset = @blueprint.datasets('dataset.id')
14
- @attribute = @dataset.attributes('attr.id.name')
15
- end
16
-
17
- it 'should return label id and direction of sorted attribute' do
18
- expect(@attribute.order_by).to eq 'label.id.name.name_label_2 - DESC'
19
- end
20
- end
@@ -1,28 +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::Model::AttributeBlueprintField do
10
- before(:each) do
11
- @model_view = MultiJson.load(File.read('./spec/data/wire_models/model_view.json'))
12
- @blueprint = GoodData::Model::FromWire.from_wire(@model_view)
13
- @dataset = @blueprint.datasets('dataset.account')
14
- @attribute = @dataset.attributes('attr.account.region')
15
- end
16
-
17
- describe '#labels' do
18
- it 'should return labels on dataset' do
19
- expect(@attribute.labels.count).to eq 1
20
- end
21
- end
22
-
23
- describe '#dataset' do
24
- it 'should return dataset of the attribtue field' do
25
- expect(@attribute.dataset_blueprint).to eq @dataset
26
- end
27
- end
28
- end