lws 0.4.2 → 6.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +4 -2
- data/bin/lwsconsole +32 -35
- data/lib/lws/auth.rb +425 -152
- data/lib/lws/corporate_website.rb +186 -68
- data/lib/lws/digital_signage.rb +1796 -0
- data/lib/lws/generic.rb +46 -50
- data/lib/lws/maps.rb +84 -38
- data/lib/lws/presence.rb +93 -73
- data/lib/lws/stubbing.rb +2 -2
- data/lib/lws/ticket.rb +230 -177
- data/lib/lws/version.rb +2 -2
- data/lib/lws.rb +66 -25
- data/lws.gemspec +3 -2
- data/test/api_token_middleware_test.rb +4 -4
- data/test/auth_test.rb +95 -8
- data/test/corporate_website_test.rb +44 -2
- data/test/digital_signage_test.rb +829 -0
- data/test/fixtures/auth.yml +4 -1
- data/test/fixtures/permissions.yml +0 -4
- data/test/generic_test.rb +0 -17
- data/test/json_parser_test.rb +57 -0
- data/test/logger_test.rb +2 -1
- data/test/maps_test.rb +22 -1
- data/test/presence_test.rb +18 -18
- data/test/setup_test.rb +5 -0
- data/test/stubbing_test.rb +4 -2
- data/test/test_helper.rb +3 -2
- data/test/ticket_test.rb +59 -44
- metadata +43 -24
data/lws.gemspec
CHANGED
@@ -14,18 +14,19 @@ Gem::Specification.new do |s|
|
|
14
14
|
|
15
15
|
s.add_runtime_dependency "faraday_middleware", ">= 0.10.0", "< 1.0"
|
16
16
|
s.add_runtime_dependency 'hashie'
|
17
|
-
s.add_runtime_dependency 'her', '~> 0.8.2'
|
18
17
|
s.add_runtime_dependency 'multi_json'
|
18
|
+
s.add_runtime_dependency 'pry'
|
19
|
+
s.add_runtime_dependency 'spyke', '~> 0.5.1'
|
19
20
|
s.add_runtime_dependency 'webmock', '~> 2.1.0'
|
20
21
|
|
21
22
|
s.add_development_dependency "faraday_middleware", ">= 0.10.0", "< 1.0"
|
22
23
|
s.add_development_dependency 'hashie'
|
23
|
-
s.add_development_dependency 'her', '~> 0.8.1'
|
24
24
|
s.add_development_dependency 'minitest'
|
25
25
|
s.add_development_dependency 'multi_json'
|
26
26
|
s.add_development_dependency 'rake', '~> 0.9.2'
|
27
27
|
s.add_development_dependency 'simplecov'
|
28
28
|
s.add_development_dependency 'simplecov-rcov'
|
29
|
+
s.add_development_dependency 'spyke', '~> 0.5.1'
|
29
30
|
|
30
31
|
s.files = `git ls-files`.split("\n")
|
31
32
|
s.test_files = `git ls-files -- test/*`.split("\n")
|
@@ -36,8 +36,8 @@ class TestAPITokenMiddleware < MiniTest::Test
|
|
36
36
|
reconfigure(api_token: nil,
|
37
37
|
api_token_middleware: WorkingTokenAuthenticator)
|
38
38
|
|
39
|
-
|
40
|
-
refute_nil(
|
39
|
+
token = LWS::Auth::Token.all.first
|
40
|
+
refute_nil(token)
|
41
41
|
|
42
42
|
# Restore the token
|
43
43
|
reconfigure
|
@@ -48,8 +48,8 @@ class TestAPITokenMiddleware < MiniTest::Test
|
|
48
48
|
reconfigure(api_token: nil,
|
49
49
|
api_token_middleware: BrokenTokenAuthenticator)
|
50
50
|
|
51
|
-
|
52
|
-
assert_nil(
|
51
|
+
token = LWS::Auth::Token.all.first
|
52
|
+
assert_nil(token)
|
53
53
|
|
54
54
|
# Restore the token
|
55
55
|
reconfigure
|
data/test/auth_test.rb
CHANGED
@@ -19,13 +19,13 @@ class TestAuthAccount < MiniTest::Test
|
|
19
19
|
@account = Account.find(1)
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def test_valid
|
23
23
|
refute_nil(@account)
|
24
24
|
assert_instance_of(Account, @account)
|
25
25
|
refute_nil(@account.id)
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def test_valid_associations
|
29
29
|
assert_instance_of(App, @account.apps.first)
|
30
30
|
assert_instance_of(Company, @account.company)
|
31
31
|
if @account.users.present?
|
@@ -34,6 +34,8 @@ class TestAuthAccount < MiniTest::Test
|
|
34
34
|
if @account.devices.present?
|
35
35
|
assert_instance_of(Device, @account.devices.first)
|
36
36
|
end
|
37
|
+
# FIXME: Doesn't work
|
38
|
+
#assert_instance_of(App, @account.start_app)
|
37
39
|
end
|
38
40
|
|
39
41
|
end
|
@@ -46,12 +48,19 @@ class TestAuthApp < MiniTest::Test
|
|
46
48
|
@app = App.all.first
|
47
49
|
end
|
48
50
|
|
49
|
-
def
|
51
|
+
def test_valid
|
50
52
|
refute_nil(@app)
|
51
53
|
assert_instance_of(App, @app)
|
52
54
|
refute_nil(@app.id)
|
53
55
|
end
|
54
56
|
|
57
|
+
def test_valid_associations
|
58
|
+
# FIXME: Doesn't work
|
59
|
+
#assert_instance_of(Account, @app.accounts.first)
|
60
|
+
#assert_instance_of(Company, @app.companies.first)
|
61
|
+
#assert_instance_of(License, @app.licenses.first)
|
62
|
+
end
|
63
|
+
|
55
64
|
end
|
56
65
|
|
57
66
|
class TestAuthCompany < MiniTest::Test
|
@@ -60,18 +69,73 @@ class TestAuthCompany < MiniTest::Test
|
|
60
69
|
|
61
70
|
def setup
|
62
71
|
@company = Company.find(1)
|
72
|
+
@child_company = Company.find(2)
|
63
73
|
end
|
64
74
|
|
65
|
-
def
|
75
|
+
def test_valid
|
66
76
|
refute_nil(@company)
|
67
77
|
assert_instance_of(Company, @company)
|
68
78
|
refute_nil(@company.id)
|
69
79
|
end
|
70
80
|
|
71
|
-
def
|
81
|
+
def test_valid_associations
|
72
82
|
assert_instance_of(Account, @company.accounts.first)
|
73
|
-
assert_instance_of(Account, @company.contact_person)
|
74
83
|
assert_instance_of(App, @company.apps.first)
|
84
|
+
assert_instance_of(Account, @company.contact_person)
|
85
|
+
# FIXME: Doesn't work
|
86
|
+
#assert_instance_of(Contract, @company.contracts.first)
|
87
|
+
assert_instance_of(License, @company.licenses.first)
|
88
|
+
assert_instance_of(Company, @child_company.parent)
|
89
|
+
# FIXME: Doesn't work
|
90
|
+
#assert_instance_of(UsageReport, @company.usage_reports.first)
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
# FIXME: Can't get a contract to test
|
96
|
+
#class TestAuthContract < MiniTest::Test
|
97
|
+
#
|
98
|
+
# include LWS::Auth
|
99
|
+
#
|
100
|
+
# def setup
|
101
|
+
# @company = Company.find(1)
|
102
|
+
# # Contracts only exist as child objects of companies
|
103
|
+
# @contract = @company.contracts.first
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# def test_valid
|
107
|
+
# refute_nil(@contract)
|
108
|
+
# assert_instance_of(Contract, @contract)
|
109
|
+
# refute_nil(@contract.id)
|
110
|
+
# end
|
111
|
+
#
|
112
|
+
# def test_valid_associations
|
113
|
+
# assert_instance_of(Company, @contract.company)
|
114
|
+
# assert_equal(@company, @contract.company)
|
115
|
+
# end
|
116
|
+
#
|
117
|
+
#end
|
118
|
+
|
119
|
+
class TestAuthLicense < MiniTest::Test
|
120
|
+
|
121
|
+
include LWS::Auth
|
122
|
+
|
123
|
+
def setup
|
124
|
+
@company = Company.find(1)
|
125
|
+
# Licenses only exist as child objects of companies
|
126
|
+
@license = @company.licenses.first
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_valid
|
130
|
+
refute_nil(@license)
|
131
|
+
assert_instance_of(License, @license)
|
132
|
+
refute_nil(@license.id)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_valid_associations
|
136
|
+
assert_instance_of(App, @license.app)
|
137
|
+
assert_instance_of(Company, @license.company)
|
138
|
+
assert_equal(@company, @license.company)
|
75
139
|
end
|
76
140
|
|
77
141
|
end
|
@@ -84,14 +148,14 @@ class TestAuthToken < MiniTest::Test
|
|
84
148
|
@token = Token.find(ENV["LC_LWS_TEST_TOKEN"])
|
85
149
|
end
|
86
150
|
|
87
|
-
def
|
151
|
+
def test_valid
|
88
152
|
refute_nil(@token)
|
89
153
|
assert_instance_of(Token, @token)
|
90
154
|
refute_nil(@token.id)
|
91
155
|
assert_equal(@token.token, LWS.config.api_token)
|
92
156
|
end
|
93
157
|
|
94
|
-
def
|
158
|
+
def test_valid_associations
|
95
159
|
refute_nil(@token.account)
|
96
160
|
if @token.user.present?
|
97
161
|
assert_instance_of(User, @token.user)
|
@@ -105,3 +169,26 @@ class TestAuthToken < MiniTest::Test
|
|
105
169
|
end
|
106
170
|
|
107
171
|
end
|
172
|
+
|
173
|
+
# FIXME: Can't get a usage report to test
|
174
|
+
#class TestAuthUsageReport < MiniTest::Test
|
175
|
+
#
|
176
|
+
# include LWS::Auth
|
177
|
+
#
|
178
|
+
# def setup
|
179
|
+
# @company = Company.find(1)
|
180
|
+
# @usage_report = @company.usage_reports.first
|
181
|
+
# end
|
182
|
+
#
|
183
|
+
# def test_valid
|
184
|
+
# refute_nil(@usage_report)
|
185
|
+
# assert_instance_of(UsageReport, @usage_report)
|
186
|
+
# refute_nil(@usage_report.id)
|
187
|
+
# end
|
188
|
+
#
|
189
|
+
# def test_valid_associations
|
190
|
+
# assert_instance_of(Company, @usage_report.company)
|
191
|
+
# assert_equal(@company, @usagee_report.company)
|
192
|
+
# end
|
193
|
+
#
|
194
|
+
#end
|
@@ -19,7 +19,7 @@ class TestCorporateWebsiteArticle < MiniTest::Test
|
|
19
19
|
@article = Article.all.first
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
22
|
+
def test_valid
|
23
23
|
refute_nil(@article)
|
24
24
|
assert_instance_of(Article, @article)
|
25
25
|
refute_nil(@article.id)
|
@@ -35,10 +35,52 @@ class TestCorporateWebsiteOfficeTime < MiniTest::Test
|
|
35
35
|
@office_time = OfficeTime.all.first
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
38
|
+
def test_valid
|
39
39
|
refute_nil(@office_time)
|
40
40
|
assert_instance_of(OfficeTime, @office_time)
|
41
41
|
refute_nil(@office_time.id)
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
45
|
+
|
46
|
+
# FIXME: There is no social page to test
|
47
|
+
#class TestCorporateWebsiteSocialPage < MiniTest::Test
|
48
|
+
#
|
49
|
+
# include LWS::CorporateWebsite
|
50
|
+
#
|
51
|
+
# def setup
|
52
|
+
# @social_page = SocialPage.all.first
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# def test_valid
|
56
|
+
# refute_nil(@social_page)
|
57
|
+
# assert_instance_of(SocialPage, @social_page)
|
58
|
+
# refute_nil(@social_page.id)
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# def test_valid_associations
|
62
|
+
# assert_instance_of(LWS::Auth::Account, @social_page.account)
|
63
|
+
# assert_instance_of(LWS::Auth::Company, @social_page.company)
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
#end
|
67
|
+
|
68
|
+
class TestCorporateWebsiteSocialPost < MiniTest::Test
|
69
|
+
|
70
|
+
include LWS::CorporateWebsite
|
71
|
+
|
72
|
+
def setup
|
73
|
+
@social_post = SocialPost.all.first
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_valid
|
77
|
+
refute_nil(@social_post)
|
78
|
+
assert_instance_of(SocialPost, @social_post)
|
79
|
+
refute_nil(@social_post.id)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_valid_associations
|
83
|
+
assert_instance_of(Article, @social_post.article)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|