alinta-cucumber-rest-bdd 0.5.9 → 0.5.10

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
  SHA1:
3
- metadata.gz: bc3affbddafe52faf5c995a213a055d717228882
4
- data.tar.gz: 845eca8241d3d85389fbaf034ba8a62e4db1f39d
3
+ metadata.gz: fe70e96cbff350a2232d09a3cf6909c601da3a41
4
+ data.tar.gz: 363099350bbafcc21fa300a6db7c6ecb536a0065
5
5
  SHA512:
6
- metadata.gz: 928840fe9666f63e56df84269a2c23d743dd2807efd4a9b9eb7a963ae6dd7c4909ba070fd489350330f07136fc66d6150cfa7212cc82b78a3f7ab92df4b5b2ad
7
- data.tar.gz: 670bec83ec40969685862cf378f924fe8b3741ced46b433476ea895b313fb5dc7c04f0572864f0e34296b7a8955cff841796a3e5e55b0d2fda959eff0891ed02
6
+ metadata.gz: fd6253343ffeb9230ef1865100ce202d9125ed091c7683e738ed4a08d8a41aea3b7ae8ee1f162e986372c46eb6f389cc2cce14c3733a76cd6c8260eb743fbf05
7
+ data.tar.gz: f7117667cd94204f75b1fe7650a365d95a9c76607af34e0546b3d0454c2b4a1f70243281593b5ab575dc5765a8bf293dae2916855b5e9a54633de5946f39e308
@@ -0,0 +1,63 @@
1
+ Given(/^I retrieve the API Management subscription key$/) do
2
+ if @apim_subscription_key.to_s.empty?
3
+ @apim_subscription_key = ENV['apim_subscription_key']
4
+
5
+ if @apim_subscription_key.to_s.empty?
6
+ steps %Q{
7
+ Given I retrieve the secret "APIMgmnt--End2End--Starter--Primary" from Azure Storage Vault
8
+ }
9
+ @apim_subscription_key = @response.get_as_type "$..value", "string"
10
+ end
11
+ end
12
+ end
13
+
14
+ Given(/^I add the API Management key header$/) do
15
+ steps %Q{
16
+ And I add Headers:
17
+ | Ocp-Apim-Subscription-Key | #{@apim_subscription_key} |
18
+ }
19
+ end
20
+
21
+ Given(/^I retrieve the secret "(.*?)" from Azure Storage Vault$/) do |secret_name|
22
+ tenant_id = ENV['ALINTA_TENANTID']
23
+ client_id = ENV['ALINTA_CLIENTID']
24
+ client_secret = ENV['ALINTA_CLIENTSECRET']
25
+ vault_name = ENV['ALINTA_VAULT']
26
+ if tenant_id.nil? or client_id.nil? or client_secret.nil? or vault_name.nil?
27
+ fail('One or more required environment variables have not been defined.')
28
+ end
29
+ steps %Q{
30
+ Given I authenticate with Azure Storage Vault tenant "#{tenant_id}" using client credentials "#{client_id}" and "#{client_secret}"
31
+ }
32
+ access_token = @response.get_as_type "$..access_token", "string"
33
+ steps %Q{
34
+ And I request the secret "#{secret_name}" from Azure Storage Vault "#{vault_name}" using token "#{access_token}"
35
+ }
36
+ end
37
+
38
+ Given(/^I authenticate with Azure Storage Vault tenant "(.*?)" using client credentials "(.*?)" and "(.*?)"$/) do |tenant_id, client_id, client_secret|
39
+ steps %Q{
40
+ Given I authenticate with "https://login.windows.net/#{tenant_id}/oauth2/token" using client credentials "#{client_id}" and "#{client_secret}"
41
+ }
42
+ end
43
+
44
+ Given(/^I authenticate with "(.*?)" using client credentials "(.*?)" and "(.*?)"$/) do |url, client_id, client_secret|
45
+ steps %Q{
46
+ Given I send "www-x-form-urlencoded" and accept JSON
47
+ When I set JSON request body to '{"grant_type": "client_credentials", "client_id": "#{client_id}", "client_secret": "#{client_secret}", "resource": "https://vault.azure.net"}'
48
+ And I send a POST request to "#{url}"
49
+ Then the request was successful
50
+ }
51
+ end
52
+
53
+ Given(/^I request the secret "(.*?)" from Azure Storage Vault "(.*?)" using token "(.*?)"$/) do |secret_name, vault_name, access_token|
54
+ api_version = '2015-06-01'
55
+ url = "https://#{vault_name}.vault.azure.net/secrets/#{secret_name}?api-version=#{api_version}"
56
+ steps %Q{
57
+ Given I send and accept JSON
58
+ And I add Headers:
59
+ | Authorization | Bearer #{access_token} |
60
+ When I send a GET request to "#{url}"
61
+ Then the request was successful
62
+ }
63
+ end
@@ -1,3 +1,4 @@
1
+ require 'cucumber-rest-bdd/steps/auth'
1
2
  require 'cucumber-rest-bdd/steps/functional'
2
3
  require 'cucumber-rest-bdd/steps/response'
3
4
  require 'cucumber-rest-bdd/steps/resource'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alinta-cucumber-rest-bdd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Bragg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-31 00:00:00.000000000 Z
12
+ date: 2018-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: alinta-cucumber-api
@@ -65,6 +65,7 @@ files:
65
65
  - lib/cucumber-rest-bdd/hash.rb
66
66
  - lib/cucumber-rest-bdd/level.rb
67
67
  - lib/cucumber-rest-bdd/steps.rb
68
+ - lib/cucumber-rest-bdd/steps/auth.rb
68
69
  - lib/cucumber-rest-bdd/steps/functional.rb
69
70
  - lib/cucumber-rest-bdd/steps/resource.rb
70
71
  - lib/cucumber-rest-bdd/steps/response.rb
@@ -91,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
92
  version: '0'
92
93
  requirements: []
93
94
  rubyforge_project:
94
- rubygems_version: 2.6.13
95
+ rubygems_version: 2.6.14
95
96
  signing_key:
96
97
  specification_version: 4
97
98
  summary: BDD Rest API specifics for cucumber