alinta-testing 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f18e3e866d81783ed06d2dc1fcdf218df473ef2014facd163bd5603cdb5a7230
4
- data.tar.gz: 714fc815b6bed5f22d64a2d944b0127de5a70dc645eecd0b4bf47d000ed807fb
3
+ metadata.gz: 915afa8d4217314324b96bad612d3fe5703c076a88f9cea988e1cde0bb7f3eb1
4
+ data.tar.gz: 629d8af1c90fb196355404fd5db123bf233bb663d16f4b7e0ddfb78cdb016270
5
5
  SHA512:
6
- metadata.gz: 70828196554a043d8331f7919d056fde46eeb1a8b4bd84cf18870857c75f1f91487155a9a4ce601d128e3b93bb452eec477a590ef503748507697a4e8f025a45
7
- data.tar.gz: 9427a2e2ea9fd2ec713ca8af1ccb17dcf06f44a1bd86eac7452535d45f66dfa348e08694ad477fbc4d4771ee23789c1cca914c21dc84bccc897fa5130d8fa2f3
6
+ metadata.gz: '05633495e2ec59b19fc022bd0b94d24e96107c4b72bd0f4e0274a3bebb99905d8f329a64e6d04813e4671cd81aab48f0ddd614614204747dde75c087bac19612'
7
+ data.tar.gz: e3725702804b8b5c2664c2368f86f4535986590159e14715abf79e2a3571f32cf1660a483c6591adb3fb62942f9ca2023a530f0f2422e99c01979af7ddddfad0
@@ -1,4 +1,5 @@
1
1
  require 'cucumber-rest-bdd'
2
+ require 'alinta-testing/overrides/get_url'
2
3
 
3
4
  class Hash
4
5
  def deep_include?(other)
@@ -41,6 +42,7 @@ def get_url(path)
41
42
  url
42
43
  end
43
44
 
45
+
44
46
  module RestClient
45
47
 
46
48
  # A global setting to verify ssl certs for all requests. This can be overridden on a
@@ -0,0 +1,38 @@
1
+
2
+ def get_url(path)
3
+ raise %(Please set an 'endpoint' environment variable provided with the url of the api) unless ENV.key?('endpoint')
4
+
5
+ get_url_internal(path, ENV['endpoint'], @urlbasepath, ENV['api_version'])
6
+ end
7
+
8
+ def get_url_internal(path, endpoint, urlbasepath, apiversion)
9
+ # remove leading and trailing slashes
10
+ path = path.gsub(/^\/?(.*)\/?$/, '\1')
11
+
12
+ if urlbasepath.to_s.empty?
13
+ splitpath = path.split('/')
14
+ basepath = splitpath.first()
15
+ path = splitpath.drop(1).join('/')
16
+ else
17
+ basepath = urlbasepath
18
+ end
19
+
20
+ # base end point for all calls
21
+ url = endpoint
22
+ url = "#{url}/" unless url.end_with?('/')
23
+
24
+ # common sub-path for this feature
25
+ url = "#{url}#{basepath}" unless basepath.to_s.empty?
26
+ url = "#{url}/" unless url.end_with?('/')
27
+
28
+ # versioned route for UAT environments
29
+ version = apiversion
30
+ url = "#{url}#{version}" unless version.to_s.empty?
31
+ url = "#{url}/" unless url.end_with?('/')
32
+
33
+ # final path for this request
34
+ url = "#{url}#{path}" unless path.empty?
35
+ url = "#{url}/" unless url.end_with?('/')
36
+
37
+ url
38
+ end
@@ -89,18 +89,10 @@ Given("I retrieve the secret {string} from Azure Storage Vault {string} using ac
89
89
  end
90
90
 
91
91
  Given("I am issuing versioned requests") do
92
- if ENV['api_version'] != nil && ENV['api_version'] != ""
93
- @urlbasepath = ENV['api_version']
94
- @urlbasepath = "#{@urlbasepath}/" unless @urlbasepath.end_with?('/')
95
- end
96
92
  end
97
93
 
98
94
  Given("I am issuing versioned requests for {resource_name}") do |resource|
99
95
  @urlbasepath = resource
100
96
  @urlbasepath = "#{@urlbasepath}/" unless @urlbasepath.end_with?('/')
101
- if ENV['api_version'] != nil && ENV['api_version'] != ""
102
- @urlbasepath = "#{@urlbasepath}#{ENV['api_version']}"
103
- @urlbasepath = "#{@urlbasepath}/" unless @urlbasepath.end_with?('/')
104
- end
105
97
  end
106
98
 
@@ -1,3 +1,3 @@
1
1
  module AlintaTesting
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alinta-testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Hosking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-02 00:00:00.000000000 Z
11
+ date: 2019-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-rest-bdd
@@ -33,6 +33,7 @@ extra_rdoc_files: []
33
33
  files:
34
34
  - lib/alinta-testing.rb
35
35
  - lib/alinta-testing/overrides.rb
36
+ - lib/alinta-testing/overrides/get_url.rb
36
37
  - lib/alinta-testing/steps.rb
37
38
  - lib/alinta-testing/steps/azure.rb
38
39
  - lib/alinta-testing/version.rb