ops_manager_ui_drivers 1.27.0 → 1.28.0

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: 1759152579edac973cb280c2739aa124ede9bd99
4
- data.tar.gz: d9c0e28827ce475a6f50e0bb10bc7af7ae4c055e
3
+ metadata.gz: 21a2cc7729f55038dd726791dc6d03c78789150c
4
+ data.tar.gz: 3f444295709edbc4254ba8ad73d0ff6e2243bf39
5
5
  SHA512:
6
- metadata.gz: 0e9ae544ee237f523f16d0eba6b216d2b4125300d22e9057a1c07c66f24d2b13066931b778bc4104f7eba3093d508d531bf4169d797eba354f2bd624bcbc4dc3
7
- data.tar.gz: 3a31071e5cbb4b4284bd3f371959cc77ac0ab7bd9e9dbba6f4876aa853804f5aaece61eef401e6a24e64f63bfd11ecef2e980fa075d2319a5109a86f695b94c9
6
+ metadata.gz: f4904aba2cd6d3a964dbc57dc2e44893cc7a197abfdd0e48453eb8eddd7fcbd143b68b5c0a682441eee3093036afa41221947d5d9d53fdcc16db59b4cef6686e
7
+ data.tar.gz: 14f79d8e4cd070d2557ad0e28a3316e9ff150b82df501db82835a4a9ad5647311655a8d4da22a497c909762289708ebc3461a86751db61bd6c25a769091dd8c3
@@ -1,3 +1,3 @@
1
1
  module OpsManagerUiDrivers
2
- VERSION = '1.27.0'
2
+ VERSION = '1.28.0'
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require 'ops_manager_ui_drivers/version16/api'
2
+ require 'uaa'
2
3
 
3
4
  module OpsManagerUiDrivers
4
5
  module Version17
@@ -9,14 +10,38 @@ module OpsManagerUiDrivers
9
10
  http.request(put(feature_flag_path, enabled: value))
10
11
  end
11
12
 
13
+ def get_products
14
+ http.request(get('v0/products'), uaa_token.auth_header)
15
+ end
16
+
12
17
  private
13
18
 
14
- def put(endpoint, form_data)
19
+ def uaa_token
20
+ target_url = @host_uri.to_s + '/uaa'
21
+ token_issuer = CF::UAA::TokenIssuer.new(target_url, 'opsman', nil, {:skip_ssl_validation => true})
22
+ token_issuer.owner_password_grant('admin', 'admin')
23
+ end
24
+
25
+ def get(endpoint, token=nil)
26
+ Net::HTTP::Get.new(api_uri(endpoint).request_uri).tap do |get|
27
+ add_auth_to_request(get, token)
28
+ end
29
+ end
30
+
31
+ def put(endpoint, form_data, token=nil)
15
32
  Net::HTTP::Put.new(api_uri(endpoint).request_uri).tap do |put_request|
16
- put_request.basic_auth(@username, @password)
33
+ add_auth_to_request(put_request, token)
17
34
  put_request.set_form_data(form_data)
18
35
  end
19
36
  end
37
+
38
+ def add_auth_to_request(request, token)
39
+ if token.present?
40
+ request['Authorization'] = token
41
+ else
42
+ request.basic_auth(@username, @password)
43
+ end
44
+ end
20
45
  end
21
46
  end
22
47
  end
@@ -3,13 +3,13 @@ require 'ops_manager_ui_drivers/version16/setup'
3
3
  module OpsManagerUiDrivers
4
4
  module Version17
5
5
  class Setup < Version16::Setup
6
- def setup_and_login(user:, password:)
6
+ def setup_and_login(user:, password:, decryption_passphrase: password)
7
7
  browser.visit '/setup'
8
8
  browser.fill_in 'setup[admin_user_name]', with: user, wait: 4
9
9
  browser.fill_in 'setup[admin_password]', with: password
10
10
  browser.fill_in 'setup[admin_password_confirmation]', with: password
11
- browser.fill_in 'setup[decryption_passphrase]', with: password
12
- browser.fill_in 'setup[decryption_passphrase_confirmation]', with: password
11
+ browser.fill_in 'setup[decryption_passphrase]', with: decryption_passphrase
12
+ browser.fill_in 'setup[decryption_passphrase_confirmation]', with: decryption_passphrase
13
13
  browser.check 'setup_eula_accepted'
14
14
  browser.click_on 'create-setup-action'
15
15
 
@@ -31,15 +31,25 @@ module OpsManagerUiDrivers
31
31
  end
32
32
  end
33
33
 
34
- def setup_or_login(user:, password:)
34
+ def setup_or_login(user:, password:, decryption_passphrase: password)
35
35
  browser.visit '/'
36
36
 
37
37
  if browser.current_path == '/setup'
38
- setup_and_login(user: user, password: password)
38
+ setup_and_login(user: user, password: password, decryption_passphrase: decryption_passphrase)
39
+ elsif browser.current_path == '/unlock'
40
+ unlock_and_login(user: user, password: password, decryption_passphrase: decryption_passphrase)
39
41
  elsif browser.current_path == '/uaa/login'
40
42
  login(user: user, password: password)
41
43
  end
42
44
  end
45
+
46
+ private
47
+
48
+ def unlock_and_login(user:, password:, decryption_passphrase: password)
49
+ browser.fill_in 'login[passphrase]', with: decryption_passphrase
50
+ browser.click_on 'Login'
51
+ login(user: user, password: password) unless browser.has_selector?('#main-page-marker', wait: 1)
52
+ end
43
53
  end
44
54
  end
45
55
  end
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'capybara'
23
23
  spec.add_dependency 'capybara-webkit'
24
24
  spec.add_dependency 'selenium-webdriver'
25
+ spec.add_dependency 'cf-uaa-lib'
25
26
 
26
27
  spec.add_development_dependency 'bundler'
27
28
  spec.add_development_dependency 'codeclimate-test-reporter'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ops_manager_ui_drivers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.27.0
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-24 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cf-uaa-lib
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement