leantesting 1.0.0 → 1.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 +4 -4
- data/README.md +2 -0
- data/leantesting.gemspec +1 -1
- data/tests/APIRequestTest.rb +21 -21
- data/tests/BaseClassesTest.rb +16 -16
- data/tests/ClientTest.rb +11 -11
- data/tests/EntitiesTest.rb +6 -6
- data/tests/EntityListTest.rb +9 -9
- data/tests/ExceptionsTest.rb +1 -1
- data/tests/HandlersRequestsTest.rb +25 -25
- data/tests/MockRequestsTest.rb +2 -2
- data/tests/OAuth2HandlerTest.rb +10 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0650b9de0f50228ddda2c8821f73fd84f0901ebb
|
4
|
+
data.tar.gz: 8377c2da73980950c3eee06b0d8f0ca7255196b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b86cfbfd27603d0b002d0011bba8f09c7f620b2e61691cc89c4c6eb97dcfc801cb698ae5fc553fbb673e45cdc1382d6ceb70e41dead27abdd00ef9d518c746e7
|
7
|
+
data.tar.gz: e63dbe3ff2aea21ef8a013d79dc4fe66375744d87d04f562baf7a1174e5d610446ce83dec7d09e8d9ae4d93424554db3de246be9034559486acd682e27026504
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Lean Testing Ruby SDK
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/leantesting)
|
4
|
+
|
3
5
|
**Ruby client for [Lean Testing API](https://leantesting.com/en/api-docs)**
|
4
6
|
|
5
7
|
You can sign up for a Lean Testing account at [https://leantesting.com](https://leantesting.com).
|
data/leantesting.gemspec
CHANGED
data/tests/APIRequestTest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class APIRequestTest < MiniTest::Test
|
7
7
|
|
@@ -14,32 +14,32 @@ class APIRequestTest < MiniTest::Test
|
|
14
14
|
|
15
15
|
def test_APIRequestInstanceNonStrEndpoint
|
16
16
|
assert_raises SDKInvalidArgException do
|
17
|
-
APIRequest.new(Client.new, 12751, 'GET')
|
17
|
+
APIRequest.new(LeanTesting::Client.new, 12751, 'GET')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
def test_APIRequestInstanceNonStrMethod
|
21
21
|
assert_raises SDKInvalidArgException do
|
22
|
-
APIRequest.new(Client.new, '/', 1233)
|
22
|
+
APIRequest.new(LeanTesting::Client.new, '/', 1233)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
def test_APIRequestInstanceSupportedMethod
|
26
|
-
APIRequest.new(Client.new, '/', 'GET')
|
27
|
-
APIRequest.new(Client.new, '/', 'POST')
|
28
|
-
APIRequest.new(Client.new, '/', 'PUT')
|
29
|
-
APIRequest.new(Client.new, '/', 'DELETE')
|
26
|
+
APIRequest.new(LeanTesting::Client.new, '/', 'GET')
|
27
|
+
APIRequest.new(LeanTesting::Client.new, '/', 'POST')
|
28
|
+
APIRequest.new(LeanTesting::Client.new, '/', 'PUT')
|
29
|
+
APIRequest.new(LeanTesting::Client.new, '/', 'DELETE')
|
30
30
|
end
|
31
31
|
def test_APIRequestInstanceNonSupportedMethod
|
32
32
|
assert_raises SDKInvalidArgException do
|
33
|
-
APIRequest.new(Client.new, '/', 'XXX')
|
33
|
+
APIRequest.new(LeanTesting::Client.new, '/', 'XXX')
|
34
34
|
end
|
35
35
|
end
|
36
36
|
def test_APIRequestInstanceNonArrOpts
|
37
37
|
assert_raises SDKInvalidArgException do
|
38
|
-
APIRequest.new(Client.new, '/', 'GET', 12123)
|
38
|
+
APIRequest.new(LeanTesting::Client.new, '/', 'GET', 12123)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
def test_APIRequestBadJSONResponse
|
42
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
42
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
43
43
|
req.expects(:call).returns({'data'=> '{xxxxxxxxx', 'status'=> 200})
|
44
44
|
|
45
45
|
ex = assert_raises SDKBadJSONResponseException do
|
@@ -54,19 +54,19 @@ class APIRequestTest < MiniTest::Test
|
|
54
54
|
|
55
55
|
|
56
56
|
def test_APIRequestExpectedStatus
|
57
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
57
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
58
58
|
req.expects(:call).returns({'data'=> '{"X": "X"}', 'status'=> 200})
|
59
59
|
req.exec
|
60
60
|
|
61
|
-
req = APIRequest.new(Client.new, '/any/method', 'POST')
|
61
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'POST')
|
62
62
|
req.expects(:call).returns({'data'=> '{"X": "X"}', 'status'=> 200})
|
63
63
|
req.exec
|
64
64
|
|
65
|
-
req = APIRequest.new(Client.new, '/any/method', 'PUT')
|
65
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'PUT')
|
66
66
|
req.expects(:call).returns({'data'=> '{"X": "X"}', 'status'=> 200})
|
67
67
|
req.exec
|
68
68
|
|
69
|
-
req = APIRequest.new(Client.new, '/any/method', 'DELETE')
|
69
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'DELETE')
|
70
70
|
req.expects(:call).returns({'data'=> '1', 'status'=> 204})
|
71
71
|
req.exec
|
72
72
|
end
|
@@ -77,7 +77,7 @@ class APIRequestTest < MiniTest::Test
|
|
77
77
|
|
78
78
|
|
79
79
|
def test_APIRequestUnexpectedStatusDELETE
|
80
|
-
req = APIRequest.new(Client.new, '/any/method', 'DELETE')
|
80
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'DELETE')
|
81
81
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 200})
|
82
82
|
|
83
83
|
ex = assert_raises SDKErrorResponseException do
|
@@ -91,7 +91,7 @@ class APIRequestTest < MiniTest::Test
|
|
91
91
|
|
92
92
|
|
93
93
|
def test_APIRequestUnexpectedStatusGET
|
94
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
94
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
95
95
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 204})
|
96
96
|
|
97
97
|
ex = assert_raises SDKErrorResponseException do
|
@@ -100,7 +100,7 @@ class APIRequestTest < MiniTest::Test
|
|
100
100
|
assert_match 'XXXyyy', ex.message
|
101
101
|
end
|
102
102
|
def test_APIRequestUnexpectedStatusPOST
|
103
|
-
req = APIRequest.new(Client.new, '/any/method', 'POST')
|
103
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'POST')
|
104
104
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 204})
|
105
105
|
|
106
106
|
ex = assert_raises SDKErrorResponseException do
|
@@ -109,7 +109,7 @@ class APIRequestTest < MiniTest::Test
|
|
109
109
|
assert_match 'XXXyyy', ex.message
|
110
110
|
end
|
111
111
|
def test_APIRequestUnexpectedStatusPUT
|
112
|
-
req = APIRequest.new(Client.new, '/any/method', 'PUT')
|
112
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'PUT')
|
113
113
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 204})
|
114
114
|
|
115
115
|
ex = assert_raises SDKErrorResponseException do
|
@@ -122,7 +122,7 @@ class APIRequestTest < MiniTest::Test
|
|
122
122
|
|
123
123
|
|
124
124
|
def test_APIRequestEmptyRespGET
|
125
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
125
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
126
126
|
req.expects(:call).returns({'data'=> '{}', 'status'=> 200})
|
127
127
|
|
128
128
|
ex = assert_raises SDKUnexpectedResponseException do
|
@@ -131,7 +131,7 @@ class APIRequestTest < MiniTest::Test
|
|
131
131
|
assert_match 'Empty', ex.message
|
132
132
|
end
|
133
133
|
def test_APIRequestEmptyRespPOST
|
134
|
-
req = APIRequest.new(Client.new, '/any/method', 'POST')
|
134
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'POST')
|
135
135
|
req.expects(:call).returns({'data'=> '{}', 'status'=> 200})
|
136
136
|
|
137
137
|
ex = assert_raises SDKUnexpectedResponseException do
|
@@ -140,7 +140,7 @@ class APIRequestTest < MiniTest::Test
|
|
140
140
|
assert_match 'Empty', ex.message
|
141
141
|
end
|
142
142
|
def test_APIRequestEmptyRespPUT
|
143
|
-
req = APIRequest.new(Client.new, '/any/method', 'PUT')
|
143
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'PUT')
|
144
144
|
req.expects(:call).returns({'data'=> '{}', 'status'=> 200})
|
145
145
|
|
146
146
|
ex = assert_raises SDKUnexpectedResponseException do
|
data/tests/BaseClassesTest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class BaseClassesTest < MiniTest::Test
|
7
7
|
|
@@ -12,19 +12,19 @@ class BaseClassesTest < MiniTest::Test
|
|
12
12
|
|
13
13
|
def test_EntityDataParsing
|
14
14
|
data = {'id' => 1}
|
15
|
-
entity = Entity.new(Client.new, data)
|
15
|
+
entity = Entity.new(LeanTesting::Client.new, data)
|
16
16
|
|
17
17
|
assert_equal entity.data, data
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_EntityInstanceNonArrData
|
21
21
|
assert_raises SDKInvalidArgException do
|
22
|
-
Entity.new(Client.new, '')
|
22
|
+
Entity.new(LeanTesting::Client.new, '')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
def test_EntityInstanceEmptyData
|
26
26
|
assert_raises SDKInvalidArgException do
|
27
|
-
Entity.new(Client.new, {})
|
27
|
+
Entity.new(LeanTesting::Client.new, {})
|
28
28
|
end
|
29
29
|
end
|
30
30
|
# END Entity
|
@@ -38,57 +38,57 @@ class BaseClassesTest < MiniTest::Test
|
|
38
38
|
|
39
39
|
def test_EntityHandlerCreateNonArrFields
|
40
40
|
assert_raises SDKInvalidArgException do
|
41
|
-
EntityHandler.new(Client.new).create('')
|
41
|
+
EntityHandler.new(LeanTesting::Client.new).create('')
|
42
42
|
end
|
43
43
|
end
|
44
44
|
def test_EntityHandlerCreateEmptyFields
|
45
45
|
assert_raises SDKInvalidArgException do
|
46
|
-
EntityHandler.new(Client.new).create({})
|
46
|
+
EntityHandler.new(LeanTesting::Client.new).create({})
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_EntityHandlerAllNonArrFilters
|
51
51
|
assert_raises SDKInvalidArgException do
|
52
|
-
EntityHandler.new(Client.new).all('')
|
52
|
+
EntityHandler.new(LeanTesting::Client.new).all('')
|
53
53
|
end
|
54
54
|
end
|
55
55
|
def test_EntityHandlerAllInvalidFilters
|
56
56
|
ex = assert_raises SDKInvalidArgException do
|
57
|
-
EntityHandler.new(Client.new).all({'XXXfilterXXX' => 9999})
|
57
|
+
EntityHandler.new(LeanTesting::Client.new).all({'XXXfilterXXX' => 9999})
|
58
58
|
end
|
59
59
|
assert_match 'XXXfilterXXX', ex.message
|
60
60
|
end
|
61
61
|
def test_EntityHandlerAllSupportedFilters
|
62
|
-
EntityHandler.new(Client.new).all({'include' => ''})
|
63
|
-
EntityHandler.new(Client.new).all({'limit' => 10})
|
64
|
-
EntityHandler.new(Client.new).all({'page' => 2})
|
62
|
+
EntityHandler.new(LeanTesting::Client.new).all({'include' => ''})
|
63
|
+
EntityHandler.new(LeanTesting::Client.new).all({'limit' => 10})
|
64
|
+
EntityHandler.new(LeanTesting::Client.new).all({'page' => 2})
|
65
65
|
end
|
66
66
|
|
67
67
|
def test_EntityHandlerFindNonIntID
|
68
68
|
assert_raises SDKInvalidArgException do
|
69
|
-
EntityHandler.new(Client.new).find('')
|
69
|
+
EntityHandler.new(LeanTesting::Client.new).find('')
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
73
|
def test_EntityHandlerDeleteNonIntID
|
74
74
|
assert_raises SDKInvalidArgException do
|
75
|
-
EntityHandler.new(Client.new).delete('')
|
75
|
+
EntityHandler.new(LeanTesting::Client.new).delete('')
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
def test_EntityHandlerUpdateNonIntID
|
80
80
|
assert_raises SDKInvalidArgException do
|
81
|
-
EntityHandler.new(Client.new).update('', {'x' => 5})
|
81
|
+
EntityHandler.new(LeanTesting::Client.new).update('', {'x' => 5})
|
82
82
|
end
|
83
83
|
end
|
84
84
|
def test_EntityHandlerUpdateNonArrFields
|
85
85
|
assert_raises SDKInvalidArgException do
|
86
|
-
EntityHandler.new(Client.new).update(5, '')
|
86
|
+
EntityHandler.new(LeanTesting::Client.new).update(5, '')
|
87
87
|
end
|
88
88
|
end
|
89
89
|
def test_EntityHandlerUpdateEmptyFields
|
90
90
|
assert_raises SDKInvalidArgException do
|
91
|
-
EntityHandler.new(Client.new).update(5, {})
|
91
|
+
EntityHandler.new(LeanTesting::Client.new).update(5, {})
|
92
92
|
end
|
93
93
|
end
|
94
94
|
# END EntityHandler
|
data/tests/ClientTest.rb
CHANGED
@@ -1,51 +1,51 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class BaseClassesTest < MiniTest::Test
|
7
7
|
|
8
8
|
def test_ClientDefined
|
9
|
-
Client.new
|
9
|
+
LeanTesting::Client.new
|
10
10
|
end
|
11
11
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
15
|
def test_ClientHasAuthObj
|
16
|
-
assert_instance_of OAuth2Handler, Client.new.auth
|
16
|
+
assert_instance_of OAuth2Handler, LeanTesting::Client.new.auth
|
17
17
|
end
|
18
18
|
def test_ClientHasUserObj
|
19
|
-
assert_instance_of UserHandler, Client.new.user
|
19
|
+
assert_instance_of UserHandler, LeanTesting::Client.new.user
|
20
20
|
end
|
21
21
|
def test_ClientHasProjectsObj
|
22
|
-
assert_instance_of ProjectsHandler, Client.new.projects
|
22
|
+
assert_instance_of ProjectsHandler, LeanTesting::Client.new.projects
|
23
23
|
end
|
24
24
|
def test_ClientHasBugsObj
|
25
|
-
assert_instance_of BugsHandler, Client.new.bugs
|
25
|
+
assert_instance_of BugsHandler, LeanTesting::Client.new.bugs
|
26
26
|
end
|
27
27
|
def test_ClientHasAttachmentsObj
|
28
|
-
assert_instance_of AttachmentsHandler, Client.new.attachments
|
28
|
+
assert_instance_of AttachmentsHandler, LeanTesting::Client.new.attachments
|
29
29
|
end
|
30
30
|
def test_ClientHasPlatformObj
|
31
|
-
assert_instance_of PlatformHandler, Client.new.platform
|
31
|
+
assert_instance_of PlatformHandler, LeanTesting::Client.new.platform
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
35
|
|
36
36
|
def test_InitialEmptyToken
|
37
|
-
assert !Client.new.getCurrentToken
|
37
|
+
assert !LeanTesting::Client.new.getCurrentToken
|
38
38
|
end
|
39
39
|
def test_TokenParseStorage
|
40
40
|
tokenName = '__token__test__'
|
41
|
-
client = Client.new
|
41
|
+
client = LeanTesting::Client.new
|
42
42
|
client.attachToken(tokenName)
|
43
43
|
|
44
44
|
assert_equal client.getCurrentToken, tokenName
|
45
45
|
end
|
46
46
|
def test_TokenParseNonStr
|
47
47
|
assert_raises SDKInvalidArgException do
|
48
|
-
Client.new.attachToken(7182381)
|
48
|
+
LeanTesting::Client.new.attachToken(7182381)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
data/tests/EntitiesTest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class EntitiesTest < MiniTest::Test
|
7
7
|
|
@@ -52,13 +52,13 @@ class EntitiesTest < MiniTest::Test
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_EntitiesCorrectParent
|
55
|
-
@entityColllection.each { |e| assert_kind_of Entity, e[0].new(Client.new, {'id'=> 1}) }
|
55
|
+
@entityColllection.each { |e| assert_kind_of Entity, e[0].new(LeanTesting::Client.new, {'id'=> 1}) }
|
56
56
|
end
|
57
57
|
|
58
58
|
def test_EntitiesDataParsing
|
59
59
|
data = {'id'=> 1, 'YY'=> 'strstr', 'FF'=> [1, 2, 3, 'asdasdasd'], 'GG'=> {'test1'=> true, 'test2'=> []}}
|
60
60
|
@entityColllection.each do |e|
|
61
|
-
assert_equal e[0].new(Client.new, data).data, data
|
61
|
+
assert_equal e[0].new(LeanTesting::Client.new, data).data, data
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
@@ -68,14 +68,14 @@ class EntitiesTest < MiniTest::Test
|
|
68
68
|
def test_EntitiesInstanceNonArrData
|
69
69
|
@entityColllection.each do |e|
|
70
70
|
assert_raises SDKInvalidArgException do
|
71
|
-
e[0].new(Client.new, '')
|
71
|
+
e[0].new(LeanTesting::Client.new, '')
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
75
75
|
def test_EntitiesInstanceEmptyData
|
76
76
|
@entityColllection.each do |e|
|
77
77
|
assert_raises SDKInvalidArgException do
|
78
|
-
e[0].new(Client.new, {})
|
78
|
+
e[0].new(LeanTesting::Client.new, {})
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
@@ -88,7 +88,7 @@ class EntitiesTest < MiniTest::Test
|
|
88
88
|
@entityColllection.each do |e|
|
89
89
|
next if e[1].nil?
|
90
90
|
e[1].each do |sk, sv|
|
91
|
-
assert_instance_of sv, e[0].new(Client.new, {'id'=> 1}).instance_variable_get('@' + sk)
|
91
|
+
assert_instance_of sv, e[0].new(LeanTesting::Client.new, {'id'=> 1}).instance_variable_get('@' + sk)
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
data/tests/EntityListTest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class EntityListTest < MiniTest::Test
|
7
7
|
|
@@ -12,38 +12,38 @@ class EntityListTest < MiniTest::Test
|
|
12
12
|
|
13
13
|
|
14
14
|
def test_EntityListBadRespMissingMeta
|
15
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
15
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
16
16
|
req.expects(:call).returns({'data'=> '{"x": []}', 'status'=> 200})
|
17
17
|
|
18
18
|
ex = assert_raises SDKUnexpectedResponseException do
|
19
|
-
EntityList.new(Client.new, req, 'X')
|
19
|
+
EntityList.new(LeanTesting::Client.new, req, 'X')
|
20
20
|
end
|
21
21
|
assert_match 'meta', ex.message
|
22
22
|
end
|
23
23
|
def test_EntityListBadRespMissingMetaPagination
|
24
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
24
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
25
25
|
req.expects(:call).returns({'data'=> '{"x": [], "meta": {}}', 'status'=> 200})
|
26
26
|
|
27
27
|
ex = assert_raises SDKUnexpectedResponseException do
|
28
|
-
EntityList.new(Client.new, req, 'X')
|
28
|
+
EntityList.new(LeanTesting::Client.new, req, 'X')
|
29
29
|
end
|
30
30
|
assert_match 'pagination', ex.message
|
31
31
|
end
|
32
32
|
def test_EntityListBadRespMissingCollection
|
33
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
33
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
34
34
|
req.expects(:call).returns({'data'=> '{"meta": {"pagination": {}}}', 'status'=> 200})
|
35
35
|
|
36
36
|
ex = assert_raises SDKUnexpectedResponseException do
|
37
|
-
EntityList.new(Client.new, req, 'X')
|
37
|
+
EntityList.new(LeanTesting::Client.new, req, 'X')
|
38
38
|
end
|
39
39
|
assert_match 'collection', ex.message
|
40
40
|
end
|
41
41
|
def test_EntityListBadRespMultipleCollections
|
42
|
-
req = APIRequest.new(Client.new, '/any/method', 'GET')
|
42
|
+
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
43
43
|
req.expects(:call).returns({'data'=> '{"xxy": [], "yyx": [], "meta": {"pagination": {}}}', 'status'=> 200})
|
44
44
|
|
45
45
|
ex = assert_raises SDKUnexpectedResponseException do
|
46
|
-
EntityList.new(Client.new, req, 'X')
|
46
|
+
EntityList.new(LeanTesting::Client.new, req, 'X')
|
47
47
|
end
|
48
48
|
assert_match 'multiple', ex.message
|
49
49
|
end
|
data/tests/ExceptionsTest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class HandlersTest < MiniTest::Test
|
7
7
|
|
@@ -46,9 +46,9 @@ class HandlersTest < MiniTest::Test
|
|
46
46
|
def test_HandlersCreateNonArrFields
|
47
47
|
@handlerCollection.each do |e|
|
48
48
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
49
|
-
inst = e[0].new(Client.new, 999)
|
49
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
50
50
|
else
|
51
|
-
inst = e[0].new(Client.new)
|
51
|
+
inst = e[0].new(LeanTesting::Client.new)
|
52
52
|
end
|
53
53
|
assert_raises SDKInvalidArgException do
|
54
54
|
inst.create('')
|
@@ -58,9 +58,9 @@ class HandlersTest < MiniTest::Test
|
|
58
58
|
def test_HandlersCreateEmptyFields
|
59
59
|
@handlerCollection.each do |e|
|
60
60
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
61
|
-
inst = e[0].new(Client.new, 999)
|
61
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
62
62
|
else
|
63
|
-
inst = e[0].new(Client.new)
|
63
|
+
inst = e[0].new(LeanTesting::Client.new)
|
64
64
|
end
|
65
65
|
assert_raises SDKInvalidArgException do
|
66
66
|
inst.create({})
|
@@ -75,9 +75,9 @@ class HandlersTest < MiniTest::Test
|
|
75
75
|
def test_HandlersAllNonArrFilters
|
76
76
|
@handlerCollection.each do |e|
|
77
77
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
78
|
-
inst = e[0].new(Client.new, 999)
|
78
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
79
79
|
else
|
80
|
-
inst = e[0].new(Client.new)
|
80
|
+
inst = e[0].new(LeanTesting::Client.new)
|
81
81
|
end
|
82
82
|
assert_raises SDKInvalidArgException do
|
83
83
|
inst.all('')
|
@@ -87,9 +87,9 @@ class HandlersTest < MiniTest::Test
|
|
87
87
|
def test_HandlersAllInvalidFilters
|
88
88
|
@handlerCollection.each do |e|
|
89
89
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
90
|
-
inst = e[0].new(Client.new, 999)
|
90
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
91
91
|
else
|
92
|
-
inst = e[0].new(Client.new)
|
92
|
+
inst = e[0].new(LeanTesting::Client.new)
|
93
93
|
end
|
94
94
|
assert_raises SDKInvalidArgException do
|
95
95
|
inst.all({'XXXfilterXXX'=> 9999})
|
@@ -97,7 +97,7 @@ class HandlersTest < MiniTest::Test
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
def test_HandlersAllSupportedFilters
|
100
|
-
client = Client.new
|
100
|
+
client = LeanTesting::Client.new
|
101
101
|
client.debugReturn = {
|
102
102
|
'data'=> '{"x": [], "meta": {"pagination": {}}}',
|
103
103
|
'status'=> 200
|
@@ -123,9 +123,9 @@ class HandlersTest < MiniTest::Test
|
|
123
123
|
def test_HandlersFindNonIntID
|
124
124
|
@handlerCollection.each do |e|
|
125
125
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
126
|
-
inst = e[0].new(Client.new, 999)
|
126
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
127
127
|
else
|
128
|
-
inst = e[0].new(Client.new)
|
128
|
+
inst = e[0].new(LeanTesting::Client.new)
|
129
129
|
end
|
130
130
|
assert_raises SDKInvalidArgException do
|
131
131
|
inst.find('')
|
@@ -139,9 +139,9 @@ class HandlersTest < MiniTest::Test
|
|
139
139
|
def test_HandlersDeleteNonIntID
|
140
140
|
@handlerCollection.each do |e|
|
141
141
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
142
|
-
inst = e[0].new(Client.new, 999)
|
142
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
143
143
|
else
|
144
|
-
inst = e[0].new(Client.new)
|
144
|
+
inst = e[0].new(LeanTesting::Client.new)
|
145
145
|
end
|
146
146
|
assert_raises SDKInvalidArgException do
|
147
147
|
inst.delete('')
|
@@ -156,9 +156,9 @@ class HandlersTest < MiniTest::Test
|
|
156
156
|
def test_HandlersUpdateNonIntID
|
157
157
|
@handlerCollection.each do |e|
|
158
158
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
159
|
-
inst = e[0].new(Client.new, 999)
|
159
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
160
160
|
else
|
161
|
-
inst = e[0].new(Client.new)
|
161
|
+
inst = e[0].new(LeanTesting::Client.new)
|
162
162
|
end
|
163
163
|
assert_raises SDKInvalidArgException do
|
164
164
|
inst.update('', {'x'=> 5})
|
@@ -168,9 +168,9 @@ class HandlersTest < MiniTest::Test
|
|
168
168
|
def test_HandlersUpdateNonArrFields
|
169
169
|
@handlerCollection.each do |e|
|
170
170
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
171
|
-
inst = e[0].new(Client.new, 999)
|
171
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
172
172
|
else
|
173
|
-
inst = e[0].new(Client.new)
|
173
|
+
inst = e[0].new(LeanTesting::Client.new)
|
174
174
|
end
|
175
175
|
assert_raises SDKInvalidArgException do
|
176
176
|
inst.update(5, '')
|
@@ -180,9 +180,9 @@ class HandlersTest < MiniTest::Test
|
|
180
180
|
def test_HandlersUpdateEmptyFields
|
181
181
|
@handlerCollection.each do |e|
|
182
182
|
if !e[1].nil? && e[1] == 'requiresIDInConstructor'
|
183
|
-
inst = e[0].new(Client.new, 999)
|
183
|
+
inst = e[0].new(LeanTesting::Client.new, 999)
|
184
184
|
else
|
185
|
-
inst = e[0].new(Client.new)
|
185
|
+
inst = e[0].new(LeanTesting::Client.new)
|
186
186
|
end
|
187
187
|
assert_raises SDKInvalidArgException do
|
188
188
|
inst.update(5, {})
|
@@ -196,19 +196,19 @@ class HandlersTest < MiniTest::Test
|
|
196
196
|
|
197
197
|
# HAVE SECONDARIES
|
198
198
|
def test_PlatformHandlerHasTypes
|
199
|
-
assert_instance_of PlatformTypesHandler, PlatformHandler.new(Client.new).types
|
199
|
+
assert_instance_of PlatformTypesHandler, PlatformHandler.new(LeanTesting::Client.new).types
|
200
200
|
end
|
201
201
|
def test_PlatformHandlerHasDevices
|
202
|
-
assert_instance_of PlatformDevicesHandler, PlatformHandler.new(Client.new).devices
|
202
|
+
assert_instance_of PlatformDevicesHandler, PlatformHandler.new(LeanTesting::Client.new).devices
|
203
203
|
end
|
204
204
|
def test_PlatformHandlerHasOS
|
205
|
-
assert_instance_of PlatformOSHandler, PlatformHandler.new(Client.new).os
|
205
|
+
assert_instance_of PlatformOSHandler, PlatformHandler.new(LeanTesting::Client.new).os
|
206
206
|
end
|
207
207
|
def test_PlatformHandlerHasBrowsers
|
208
|
-
assert_instance_of PlatformBrowsersHandler, PlatformHandler.new(Client.new).browsers
|
208
|
+
assert_instance_of PlatformBrowsersHandler, PlatformHandler.new(LeanTesting::Client.new).browsers
|
209
209
|
end
|
210
210
|
def test_UserHandlerHasOrganizations
|
211
|
-
assert_instance_of UserOrganizationsHandler, UserHandler.new(Client.new).organizations
|
211
|
+
assert_instance_of UserOrganizationsHandler, UserHandler.new(LeanTesting::Client.new).organizations
|
212
212
|
end
|
213
213
|
# END HAVE SECONDARIES
|
214
214
|
|
data/tests/MockRequestsTest.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class MockRequestsTest < MiniTest::Test
|
7
7
|
|
8
8
|
def setup
|
9
|
-
@client = Client.new
|
9
|
+
@client = LeanTesting::Client.new
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
data/tests/OAuth2HandlerTest.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require(:default, :test)
|
3
3
|
|
4
|
-
require_relative '../lib/
|
4
|
+
require_relative '../lib/leantesting'
|
5
5
|
|
6
6
|
class OAuth2HandlerTest < MiniTest::Test
|
7
7
|
|
@@ -14,22 +14,22 @@ class OAuth2HandlerTest < MiniTest::Test
|
|
14
14
|
|
15
15
|
def test_OAuth2HandlerGenerateNonStrClientID
|
16
16
|
assert_raises SDKInvalidArgException do
|
17
|
-
OAuth2Handler.new(Client.new).generateAuthLink(1, '', '')
|
17
|
+
OAuth2Handler.new(LeanTesting::Client.new).generateAuthLink(1, '', '')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
def test_OAuth2HandlerGenerateNonStrRedirectURI
|
21
21
|
assert_raises SDKInvalidArgException do
|
22
|
-
OAuth2Handler.new(Client.new).generateAuthLink('', 1, '')
|
22
|
+
OAuth2Handler.new(LeanTesting::Client.new).generateAuthLink('', 1, '')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
def test_OAuth2HandlerGenerateNonStrScope
|
26
26
|
assert_raises SDKInvalidArgException do
|
27
|
-
OAuth2Handler.new(Client.new).generateAuthLink('', '', 1)
|
27
|
+
OAuth2Handler.new(LeanTesting::Client.new).generateAuthLink('', '', 1)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
def test_OAuth2HandlerGenerateNonStrState
|
31
31
|
assert_raises SDKInvalidArgException do
|
32
|
-
OAuth2Handler.new(Client.new).generateAuthLink('', '', '', 1)
|
32
|
+
OAuth2Handler.new(LeanTesting::Client.new).generateAuthLink('', '', '', 1)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -38,35 +38,35 @@ class OAuth2HandlerTest < MiniTest::Test
|
|
38
38
|
|
39
39
|
def test_OAuth2HandlerExchangeNonStrClientID
|
40
40
|
assert_raises SDKInvalidArgException do
|
41
|
-
client = Client.new
|
41
|
+
client = LeanTesting::Client.new
|
42
42
|
client.debugReturn = '{}'
|
43
43
|
OAuth2Handler.new(client).exchangeAuthCode(1, '', '', '', '')
|
44
44
|
end
|
45
45
|
end
|
46
46
|
def test_OAuth2HandlerExchangeNonStrClientSecret
|
47
47
|
assert_raises SDKInvalidArgException do
|
48
|
-
client = Client.new
|
48
|
+
client = LeanTesting::Client.new
|
49
49
|
client.debugReturn = '{}'
|
50
50
|
OAuth2Handler.new(client).exchangeAuthCode('', 1, '', '', '')
|
51
51
|
end
|
52
52
|
end
|
53
53
|
def test_OAuth2HandlerExchangeNonStrGrantType
|
54
54
|
assert_raises SDKInvalidArgException do
|
55
|
-
client = Client.new
|
55
|
+
client = LeanTesting::Client.new
|
56
56
|
client.debugReturn = '{}'
|
57
57
|
OAuth2Handler.new(client).exchangeAuthCode('', '', 1, '', '')
|
58
58
|
end
|
59
59
|
end
|
60
60
|
def test_OAuth2HandlerExchangeNonStrCode
|
61
61
|
assert_raises SDKInvalidArgException do
|
62
|
-
client = Client.new
|
62
|
+
client = LeanTesting::Client.new
|
63
63
|
client.debugReturn = '{}'
|
64
64
|
OAuth2Handler.new(client).exchangeAuthCode('', '', '', 1, '')
|
65
65
|
end
|
66
66
|
end
|
67
67
|
def test_OAuth2HandlerExchangeNonStrRedirectURI
|
68
68
|
assert_raises SDKInvalidArgException do
|
69
|
-
client = Client.new
|
69
|
+
client = LeanTesting::Client.new
|
70
70
|
client.debugReturn = '{}'
|
71
71
|
OAuth2Handler.new(client).exchangeAuthCode('', '', '', '', 1)
|
72
72
|
end
|