leap_salesforce 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/.idea/dictionaries/iqa.xml +9 -0
  4. data/.idea/leap-salesforce.iml +93 -0
  5. data/.idea/markdown-navigator/profiles_settings.xml +3 -0
  6. data/.idea/markdown-navigator.xml +86 -0
  7. data/.idea/misc.xml +12 -0
  8. data/.idea/modules.xml +8 -0
  9. data/.idea/vcs.xml +6 -0
  10. data/.idea/workspace.xml +992 -0
  11. data/.leap_salesforce.yml +10 -0
  12. data/.rspec +3 -0
  13. data/.rubocop.yml +3 -0
  14. data/CODE_OF_CONDUCT.md +74 -0
  15. data/Gemfile +6 -0
  16. data/LICENSE.txt +21 -0
  17. data/README.md +56 -0
  18. data/Rakefile +21 -0
  19. data/bin/console +12 -0
  20. data/bin/setup +8 -0
  21. data/exe/leap-salesforce +7 -0
  22. data/leap_salesforce.gemspec +43 -0
  23. data/lib/leap_salesforce/ext/string.rb +34 -0
  24. data/lib/leap_salesforce/ext/time.rb +15 -0
  25. data/lib/leap_salesforce/generator/default_fields.rb +13 -0
  26. data/lib/leap_salesforce/generator/soql_enums.rb +46 -0
  27. data/lib/leap_salesforce/generator/soql_objects.rb +97 -0
  28. data/lib/leap_salesforce/generator/templates/factory.rb.erb +12 -0
  29. data/lib/leap_salesforce/generator/templates/picklist.rb.erb +30 -0
  30. data/lib/leap_salesforce/generator/templates/soql_object.rb.erb +7 -0
  31. data/lib/leap_salesforce/generator/templates/soql_object_field_names.rb.erb +10 -0
  32. data/lib/leap_salesforce/limits.rb +13 -0
  33. data/lib/leap_salesforce/parameters.rb +53 -0
  34. data/lib/leap_salesforce/rake/setup.rake +25 -0
  35. data/lib/leap_salesforce/rake.rb +5 -0
  36. data/lib/leap_salesforce/soql_data/data_relationships.rb +35 -0
  37. data/lib/leap_salesforce/soql_data/meta_data_handler.rb +11 -0
  38. data/lib/leap_salesforce/soql_data/soql_data.rb +173 -0
  39. data/lib/leap_salesforce/soql_data/soql_enum.rb +8 -0
  40. data/lib/leap_salesforce/soql_data/soql_global_data.rb +26 -0
  41. data/lib/leap_salesforce/soql_data/soql_global_object_data.rb +225 -0
  42. data/lib/leap_salesforce/soql_data/soql_handler.rb +39 -0
  43. data/lib/leap_salesforce/soql_data/soql_object_describe.rb +100 -0
  44. data/lib/leap_salesforce/soql_data/soql_settings.rb +31 -0
  45. data/lib/leap_salesforce/users/user.rb +27 -0
  46. data/lib/leap_salesforce/users/users.rb +25 -0
  47. data/lib/leap_salesforce/version.rb +5 -0
  48. data/lib/leap_salesforce.rb +63 -0
  49. metadata +292 -0
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'user'
4
+
5
+ module LeapSalesforce
6
+ # Where test users are defined
7
+ module Users
8
+ @list = []
9
+ class << self
10
+ # @return [Array] List of test users
11
+ attr_reader :list
12
+
13
+ # @param [LeapSalesforce::User]
14
+ def add(user)
15
+ @list << user
16
+ end
17
+
18
+ # Return a user that meets the criteria
19
+ def where(filter)
20
+ lookup_key, lookup_value = filter.first
21
+ @list.find { |user| user.send(lookup_key) == lookup_value }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LeapSalesforce
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'leap_salesforce/version'
4
+
5
+ require 'soaspec'
6
+ require 'active_support/core_ext/integer/time' # Creating time objects
7
+ require 'leap_salesforce/parameters'
8
+ require 'leap_salesforce/ext/string'
9
+ require 'leap_salesforce/ext/time'
10
+ require 'require_all'
11
+ require 'rake'
12
+ require 'factory_bot'
13
+
14
+ module LeapSalesforce
15
+ class Error < StandardError; end
16
+ # Error related to handling a response
17
+ class ResponseError < StandardError; end
18
+ # Error related to setup of test automation suite
19
+ class SetupError < Error; end
20
+ end
21
+
22
+ LEAP_CONFIG_FILE = '.leap_salesforce.yml'
23
+ CREDENTIAL_FILE = File.join('config', 'credentials', 'salesforce_oauth2.yml')
24
+
25
+ leap_logger = Logger.new STDOUT
26
+ leap_logger.level = Logger::DEBUG
27
+ leap_logger.datetime_format = '%Y-%m-%d %H:%M:%S'
28
+
29
+ if File.exist? LEAP_CONFIG_FILE
30
+ leap_config = YAML.load_file LEAP_CONFIG_FILE
31
+ LeapSalesforce.soql_objects = leap_config.delete('soql_objects')
32
+ leap_config.each do |key, value|
33
+ if %w[client_id client_secret password].include? key
34
+ leap_logger.warn "Secret key '#{key}' should be in non version" \
35
+ " controlled #{CREDENTIAL_FILE} not in #{LEAP_CONFIG_FILE}"
36
+ end
37
+ LeapSalesforce.send("#{key}=", value)
38
+ end
39
+ else
40
+ leap_logger.warn 'No config file found for Leap Salesforce'
41
+ end
42
+
43
+ raise LeapSalesforce::SetupError, 'LeapSalesforce.environment not set' if LeapSalesforce.environment.nil?
44
+
45
+ if File.exist? CREDENTIAL_FILE
46
+ YAML.load_file(CREDENTIAL_FILE).each do |key, value|
47
+ LeapSalesforce.send("#{key}=", value)
48
+ end
49
+ end
50
+
51
+ %w[client_id client_secret password].each do |param|
52
+ raise LeapSalesforce::SetupError, "LeapSalesforce.#{param} not set" if LeapSalesforce.send(param).nil?
53
+ end
54
+
55
+ require File.join(Dir.pwd, LeapSalesforce.config_folder, 'general')
56
+ require File.join(Dir.pwd, LeapSalesforce.config_folder, 'environments', LeapSalesforce.environment)
57
+
58
+ require 'leap_salesforce/soql_data/soql_data'
59
+ require 'leap_salesforce/limits'
60
+
61
+ require_all LeapSalesforce.lib_folder
62
+
63
+ LeapSalesforce.objects_to_verify = SoqlData.descendants if LeapSalesforce.objects_to_verify.empty?
metadata ADDED
@@ -0,0 +1,292 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: leap_salesforce
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - IQA
8
+ - Samuel Garratt
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2019-07-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '2.0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '2.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: faker
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: pry
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '10.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '10.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '3.0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: topoisomerase
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: activerecord
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: factory_bot
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rake
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :runtime
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: require_all
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :runtime
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
154
+ - !ruby/object:Gem::Dependency
155
+ name: rubocop
156
+ requirement: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ type: :runtime
162
+ prerelease: false
163
+ version_requirements: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ - !ruby/object:Gem::Dependency
169
+ name: rubykeyword
170
+ requirement: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ type: :runtime
176
+ prerelease: false
177
+ version_requirements: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - ">="
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ - !ruby/object:Gem::Dependency
183
+ name: soaspec
184
+ requirement: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
189
+ type: :runtime
190
+ prerelease: false
191
+ version_requirements: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ - !ruby/object:Gem::Dependency
197
+ name: thor
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ type: :runtime
204
+ prerelease: false
205
+ version_requirements: !ruby/object:Gem::Requirement
206
+ requirements:
207
+ - - ">="
208
+ - !ruby/object:Gem::Version
209
+ version: '0'
210
+ description: |-
211
+ This gem helps ones to perform integration tests on Salesforce.
212
+ It reads the Metadata from Salesforce and creates the foundation for API tests.
213
+ email:
214
+ - samuel.garratt@integrationqa.com
215
+ - leap.salesforce@integrationqa.com
216
+ executables:
217
+ - leap-salesforce
218
+ extensions: []
219
+ extra_rdoc_files: []
220
+ files:
221
+ - ".gitignore"
222
+ - ".idea/dictionaries/iqa.xml"
223
+ - ".idea/leap-salesforce.iml"
224
+ - ".idea/markdown-navigator.xml"
225
+ - ".idea/markdown-navigator/profiles_settings.xml"
226
+ - ".idea/misc.xml"
227
+ - ".idea/modules.xml"
228
+ - ".idea/vcs.xml"
229
+ - ".idea/workspace.xml"
230
+ - ".leap_salesforce.yml"
231
+ - ".rspec"
232
+ - ".rubocop.yml"
233
+ - CODE_OF_CONDUCT.md
234
+ - Gemfile
235
+ - LICENSE.txt
236
+ - README.md
237
+ - Rakefile
238
+ - bin/console
239
+ - bin/setup
240
+ - exe/leap-salesforce
241
+ - leap_salesforce.gemspec
242
+ - lib/leap_salesforce.rb
243
+ - lib/leap_salesforce/ext/string.rb
244
+ - lib/leap_salesforce/ext/time.rb
245
+ - lib/leap_salesforce/generator/default_fields.rb
246
+ - lib/leap_salesforce/generator/soql_enums.rb
247
+ - lib/leap_salesforce/generator/soql_objects.rb
248
+ - lib/leap_salesforce/generator/templates/factory.rb.erb
249
+ - lib/leap_salesforce/generator/templates/picklist.rb.erb
250
+ - lib/leap_salesforce/generator/templates/soql_object.rb.erb
251
+ - lib/leap_salesforce/generator/templates/soql_object_field_names.rb.erb
252
+ - lib/leap_salesforce/limits.rb
253
+ - lib/leap_salesforce/parameters.rb
254
+ - lib/leap_salesforce/rake.rb
255
+ - lib/leap_salesforce/rake/setup.rake
256
+ - lib/leap_salesforce/soql_data/data_relationships.rb
257
+ - lib/leap_salesforce/soql_data/meta_data_handler.rb
258
+ - lib/leap_salesforce/soql_data/soql_data.rb
259
+ - lib/leap_salesforce/soql_data/soql_enum.rb
260
+ - lib/leap_salesforce/soql_data/soql_global_data.rb
261
+ - lib/leap_salesforce/soql_data/soql_global_object_data.rb
262
+ - lib/leap_salesforce/soql_data/soql_handler.rb
263
+ - lib/leap_salesforce/soql_data/soql_object_describe.rb
264
+ - lib/leap_salesforce/soql_data/soql_settings.rb
265
+ - lib/leap_salesforce/users/user.rb
266
+ - lib/leap_salesforce/users/users.rb
267
+ - lib/leap_salesforce/version.rb
268
+ homepage: https://gitlab.com/leap-dojo/leap_salesforce
269
+ licenses:
270
+ - MIT
271
+ metadata: {}
272
+ post_install_message:
273
+ rdoc_options: []
274
+ require_paths:
275
+ - lib
276
+ required_ruby_version: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - ">="
279
+ - !ruby/object:Gem::Version
280
+ version: '0'
281
+ required_rubygems_version: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - ">="
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ requirements: []
287
+ rubyforge_project:
288
+ rubygems_version: 2.7.9
289
+ signing_key:
290
+ specification_version: 4
291
+ summary: Helps with setting up integrated automated test frameworks against Salesforce.
292
+ test_files: []