conify 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +9 -0
- data/Rakefile +6 -0
- data/bin/conify +30 -0
- data/config.ru +7 -0
- data/conify.gemspec +27 -0
- data/lib/.DS_Store +0 -0
- data/lib/conify.rb +2 -0
- data/lib/conify/api.rb +4 -0
- data/lib/conify/api/abstract_api.rb +78 -0
- data/lib/conify/api/addons.rb +19 -0
- data/lib/conify/api/users.rb +18 -0
- data/lib/conify/cli.rb +29 -0
- data/lib/conify/command.rb +286 -0
- data/lib/conify/command/abstract_command.rb +15 -0
- data/lib/conify/command/global.rb +109 -0
- data/lib/conify/helpers.rb +223 -0
- data/lib/conify/http.rb +56 -0
- data/lib/conify/manifest.rb +58 -0
- data/lib/conify/okjson.rb +606 -0
- data/lib/conify/sso.rb +89 -0
- data/lib/conify/test.rb +52 -0
- data/lib/conify/test/all_test.rb +23 -0
- data/lib/conify/test/api_test.rb +46 -0
- data/lib/conify/test/deprovision_test.rb +30 -0
- data/lib/conify/test/manifest_test.rb +88 -0
- data/lib/conify/test/plan_change_test.rb +33 -0
- data/lib/conify/test/provision_response_test.rb +89 -0
- data/lib/conify/test/provision_test.rb +52 -0
- data/lib/conify/test/sso_test.rb +58 -0
- data/lib/conify/version.rb +3 -0
- metadata +165 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'conify/test/api_test'
|
2
|
+
require 'conify/test/provision_response_test'
|
3
|
+
require 'conify/okjson'
|
4
|
+
|
5
|
+
class Conify::ProvisionTest < Conify::ApiTest
|
6
|
+
|
7
|
+
OUTPUT_COMPLETION = true
|
8
|
+
|
9
|
+
def call
|
10
|
+
response, code, json = nil
|
11
|
+
payload = create_provision_payload
|
12
|
+
|
13
|
+
data[:external_username] = payload[:conflux_id] # store for later
|
14
|
+
|
15
|
+
test 'response' do
|
16
|
+
code, json = post(credentials, base_path, payload)
|
17
|
+
|
18
|
+
if code == 200
|
19
|
+
# Good shit
|
20
|
+
elsif code == -1
|
21
|
+
error "Provision Test: unable to connect to #{url}"
|
22
|
+
else
|
23
|
+
error "Provision Test: expected 200, got #{code}"
|
24
|
+
end
|
25
|
+
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
test 'valid JSON' do
|
30
|
+
begin
|
31
|
+
response = OkJson.decode(json)
|
32
|
+
rescue OkJson::Error => e
|
33
|
+
error e.message
|
34
|
+
rescue NoMethodError => e
|
35
|
+
error 'Provision Test: error parsing JSON'
|
36
|
+
end
|
37
|
+
|
38
|
+
true
|
39
|
+
end
|
40
|
+
|
41
|
+
test 'authentication' do
|
42
|
+
code, _ = post(invalid_creds, base_path, payload)
|
43
|
+
error "Provision Test: expected 401, got #{code}" if code != 401
|
44
|
+
true
|
45
|
+
end
|
46
|
+
|
47
|
+
data[:provision_response] = response
|
48
|
+
|
49
|
+
run(Conify::ProvisionResponseTest, data)
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'conify/test/api_test'
|
2
|
+
require 'conify/sso'
|
3
|
+
require 'mechanize'
|
4
|
+
|
5
|
+
class Conify::SsoTest < Conify::ApiTest
|
6
|
+
|
7
|
+
OUTPUT_COMPLETION = true
|
8
|
+
|
9
|
+
def agent
|
10
|
+
@agent ||= Mechanize.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def mechanize_get
|
14
|
+
if @sso.POST?
|
15
|
+
page = agent.post(@sso.post_url, @sso.query_params)
|
16
|
+
else
|
17
|
+
page = agent.get(@sso.get_url)
|
18
|
+
end
|
19
|
+
|
20
|
+
return page, 200
|
21
|
+
rescue Mechanize::ResponseCodeError => error
|
22
|
+
return nil, error.response_code.to_i
|
23
|
+
rescue Errno::ECONNREFUSED
|
24
|
+
error "SSO Test: connection refused to #{url}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test(*args)
|
28
|
+
@sso = Conify::Sso.new(data)
|
29
|
+
super(*args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def call
|
33
|
+
error 'SSO Test: Need an sso salt to perform sso test' unless data['api']['sso_salt']
|
34
|
+
|
35
|
+
test 'validates token' do
|
36
|
+
@sso.token = 'invalid'
|
37
|
+
page, respcode = mechanize_get
|
38
|
+
error "SSO Test: expected 403, got #{respcode}" unless respcode == 403
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
test 'validates timestamp' do
|
43
|
+
@sso.timestamp = (Time.now - (60 * 6)).to_i
|
44
|
+
page, respcode = mechanize_get
|
45
|
+
error "SSO Test: expected 403, got #{respcode}" unless respcode == 403
|
46
|
+
true
|
47
|
+
end
|
48
|
+
|
49
|
+
page_logged_in = nil
|
50
|
+
|
51
|
+
test 'logs in' do
|
52
|
+
page_logged_in, respcode = mechanize_get
|
53
|
+
error "SSO Test: expected 200, got #{respcode}" unless respcode == 200
|
54
|
+
true
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: conify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Whittle
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mechanize
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.6.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.6.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- benwhittle31@gmail.com
|
100
|
+
executables:
|
101
|
+
- conify
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".DS_Store"
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".travis.yml"
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/conify
|
114
|
+
- config.ru
|
115
|
+
- conify.gemspec
|
116
|
+
- lib/.DS_Store
|
117
|
+
- lib/conify.rb
|
118
|
+
- lib/conify/api.rb
|
119
|
+
- lib/conify/api/abstract_api.rb
|
120
|
+
- lib/conify/api/addons.rb
|
121
|
+
- lib/conify/api/users.rb
|
122
|
+
- lib/conify/cli.rb
|
123
|
+
- lib/conify/command.rb
|
124
|
+
- lib/conify/command/abstract_command.rb
|
125
|
+
- lib/conify/command/global.rb
|
126
|
+
- lib/conify/helpers.rb
|
127
|
+
- lib/conify/http.rb
|
128
|
+
- lib/conify/manifest.rb
|
129
|
+
- lib/conify/okjson.rb
|
130
|
+
- lib/conify/sso.rb
|
131
|
+
- lib/conify/test.rb
|
132
|
+
- lib/conify/test/all_test.rb
|
133
|
+
- lib/conify/test/api_test.rb
|
134
|
+
- lib/conify/test/deprovision_test.rb
|
135
|
+
- lib/conify/test/manifest_test.rb
|
136
|
+
- lib/conify/test/plan_change_test.rb
|
137
|
+
- lib/conify/test/provision_response_test.rb
|
138
|
+
- lib/conify/test/provision_test.rb
|
139
|
+
- lib/conify/test/sso_test.rb
|
140
|
+
- lib/conify/version.rb
|
141
|
+
homepage: https://www.github.com/GoConflux/conify
|
142
|
+
licenses:
|
143
|
+
- MIT
|
144
|
+
metadata: {}
|
145
|
+
post_install_message:
|
146
|
+
rdoc_options: []
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
requirements: []
|
160
|
+
rubyforge_project:
|
161
|
+
rubygems_version: 2.5.1
|
162
|
+
signing_key:
|
163
|
+
specification_version: 4
|
164
|
+
summary: A gem to help developer tools integrate their services with Conflux
|
165
|
+
test_files: []
|