leantesting 1.0.1 → 1.0.2
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 -2
- data/leantesting.gemspec +1 -1
- data/lib/BaseClass/APIRequest.rb +154 -151
- data/lib/BaseClass/Entity.rb +25 -24
- data/lib/BaseClass/EntityHandler.rb +151 -149
- data/lib/BaseClass/EntityList.rb +163 -161
- data/lib/Entity/Bug/Bug.rb +10 -8
- data/lib/Entity/Bug/BugAttachment.rb +7 -5
- data/lib/Entity/Bug/BugComment.rb +7 -5
- data/lib/Entity/Platform/PlatformBrowser.rb +9 -7
- data/lib/Entity/Platform/PlatformBrowserVersion.rb +7 -5
- data/lib/Entity/Platform/PlatformDevice.rb +7 -5
- data/lib/Entity/Platform/PlatformOS.rb +9 -7
- data/lib/Entity/Platform/PlatformOSVersion.rb +7 -5
- data/lib/Entity/Platform/PlatformType.rb +9 -7
- data/lib/Entity/Project/Project.rb +24 -22
- data/lib/Entity/Project/ProjectBugScheme.rb +7 -5
- data/lib/Entity/Project/ProjectSection.rb +7 -5
- data/lib/Entity/Project/ProjectUser.rb +7 -5
- data/lib/Entity/Project/ProjectVersion.rb +7 -5
- data/lib/Entity/User/UserOrganization.rb +7 -5
- data/lib/Exception/BaseException/SDKException.rb +15 -13
- data/lib/Exception/SDKBadJSONResponseException.rb +13 -11
- data/lib/Exception/SDKDuplicateRequestException.rb +15 -13
- data/lib/Exception/SDKErrorResponseException.rb +12 -10
- data/lib/Exception/SDKIncompleteRequestException.rb +15 -13
- data/lib/Exception/SDKInvalidArgException.rb +13 -11
- data/lib/Exception/SDKMissingArgException.rb +13 -11
- data/lib/Exception/SDKUnexpectedResponseException.rb +13 -11
- data/lib/Exception/SDKUnsupportedRequestException.rb +15 -13
- data/lib/Handler/Attachment/AttachmentsHandler.rb +14 -12
- data/lib/Handler/Auth/OAuth2Handler.rb +102 -100
- data/lib/Handler/Bug/BugAttachmentsHandler.rb +44 -42
- data/lib/Handler/Bug/BugCommentsHandler.rb +16 -14
- data/lib/Handler/Bug/BugsHandler.rb +53 -51
- data/lib/Handler/Platform/PlatformBrowserVersionsHandler.rb +16 -14
- data/lib/Handler/Platform/PlatformBrowsersHandler.rb +18 -16
- data/lib/Handler/Platform/PlatformDevicesHandler.rb +9 -7
- data/lib/Handler/Platform/PlatformHandler.rb +20 -18
- data/lib/Handler/Platform/PlatformOSHandler.rb +18 -16
- data/lib/Handler/Platform/PlatformOSVersionsHandler.rb +16 -14
- data/lib/Handler/Platform/PlatformTypeDevicesHandler.rb +16 -14
- data/lib/Handler/Platform/PlatformTypesHandler.rb +17 -15
- data/lib/Handler/Project/ProjectBugReproducibilitySchemeHandler.rb +16 -14
- data/lib/Handler/Project/ProjectBugSeveritySchemeHandler.rb +16 -14
- data/lib/Handler/Project/ProjectBugStatusSchemeHandler.rb +16 -14
- data/lib/Handler/Project/ProjectBugTypeSchemeHandler.rb +16 -14
- data/lib/Handler/Project/ProjectBugsHandler.rb +55 -53
- data/lib/Handler/Project/ProjectSectionsHandler.rb +30 -28
- data/lib/Handler/Project/ProjectUsersHandler.rb +16 -14
- data/lib/Handler/Project/ProjectVersionsHandler.rb +30 -28
- data/lib/Handler/Project/ProjectsHandler.rb +34 -32
- data/lib/Handler/User/UserHandler.rb +12 -10
- data/lib/Handler/User/UserOrganizationsHandler.rb +12 -10
- data/tests/APIRequestTest.rb +33 -33
- data/tests/BaseClassesTest.rb +28 -28
- data/tests/ClientTest.rb +7 -7
- data/tests/EntitiesTest.rb +31 -31
- data/tests/EntityListTest.rb +13 -13
- data/tests/ExceptionsTest.rb +15 -15
- data/tests/HandlersRequestsTest.rb +37 -37
- data/tests/MockRequestsTest.rb +48 -48
- data/tests/OAuth2HandlerTest.rb +19 -19
- metadata +2 -1
@@ -1,67 +1,69 @@
|
|
1
|
-
|
1
|
+
module LeanTesting
|
2
|
+
class ProjectBugsHandler < LeanTesting::EntityHandler
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
def initialize(origin, projectID)
|
5
|
+
super(origin)
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
@projectID = projectID
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
def create(fields)
|
11
|
+
super
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
supports = {
|
14
|
+
'title' => true,
|
15
|
+
'status_id' => true,
|
16
|
+
'severity_id' => true,
|
17
|
+
'project_version' => true,
|
18
|
+
'project_version_id' => true,
|
19
|
+
'project_section_id' => false,
|
20
|
+
'type_id' => false,
|
21
|
+
'reproducibility_id' => false,
|
22
|
+
'assigned_user_id' => false,
|
23
|
+
'description' => false,
|
24
|
+
'expected_results' => false,
|
25
|
+
'steps' => false,
|
26
|
+
'platform' => false
|
27
|
+
# 'device_model' => false,
|
28
|
+
# 'device_model_id' => false,
|
29
|
+
# 'os' => false,
|
30
|
+
# 'os_version' => false,
|
31
|
+
# 'os_version_id' => false,
|
32
|
+
# 'browser_version_id' => false
|
33
|
+
}
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
if fields.has_key? 'project_version_id'
|
36
|
+
supports['project_version'] = false
|
37
|
+
elsif fields.has_key? 'project_version'
|
38
|
+
supports['project_version_id'] = false
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
41
|
+
if enforce(fields, supports)
|
42
|
+
fields = {'include' => 'steps,platform'}.merge(fields)
|
42
43
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
req = APIRequest.new(
|
45
|
+
@origin,
|
46
|
+
'/v1/projects/' + @projectID.to_s() + '/bugs',
|
47
|
+
'POST',
|
48
|
+
{'params' => fields}
|
49
|
+
)
|
49
50
|
|
50
|
-
|
51
|
+
Bug.new(@origin, req.exec)
|
52
|
+
end
|
51
53
|
end
|
52
|
-
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
def all(filters = nil)
|
56
|
+
if !filters
|
57
|
+
filters = {}
|
58
|
+
end
|
58
59
|
|
59
|
-
|
60
|
+
super
|
60
61
|
|
61
|
-
|
62
|
+
filters = {'include' => 'steps,platform,attachments,comments,tags'}.merge(filters)
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
|
64
|
+
request = APIRequest.new(@origin, '/v1/projects/' + @projectID.to_s() + '/bugs', 'GET')
|
65
|
+
EntityList.new(@origin, request, Bug, filters)
|
66
|
+
end
|
66
67
|
|
67
|
-
end
|
68
|
+
end
|
69
|
+
end
|
@@ -1,39 +1,41 @@
|
|
1
|
-
|
1
|
+
module LeanTesting
|
2
|
+
class ProjectSectionsHandler < LeanTesting::EntityHandler
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
def initialize(origin, projectID)
|
5
|
+
super(origin)
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
@projectID = projectID
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
def create(fields)
|
11
|
+
super
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
supports = {
|
14
|
+
'name' => true
|
15
|
+
}
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
if enforce(fields, supports)
|
18
|
+
req = APIRequest.new(
|
19
|
+
@origin,
|
20
|
+
'/v1/projects/' + @projectID.to_s() + '/sections',
|
21
|
+
'POST',
|
22
|
+
{'params' => fields}
|
23
|
+
)
|
23
24
|
|
24
|
-
|
25
|
+
ProjectSection.new(@origin, req.exec)
|
26
|
+
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def all(filters = nil)
|
30
|
+
if !filters
|
31
|
+
filters = {}
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
+
super
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
request = APIRequest.new(@origin, '/v1/projects/' + @projectID.to_s() + '/sections', 'GET')
|
37
|
+
EntityList.new(@origin, request, ProjectSection, filters)
|
38
|
+
end
|
38
39
|
|
39
|
-
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,20 +1,22 @@
|
|
1
|
-
|
1
|
+
module LeanTesting
|
2
|
+
class ProjectUsersHandler < LeanTesting::EntityHandler
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
def initialize(origin, projectID)
|
5
|
+
super(origin)
|
5
6
|
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def all(filters = nil)
|
10
|
-
if !filters
|
11
|
-
filters = {}
|
7
|
+
@projectID = projectID
|
12
8
|
end
|
13
9
|
|
14
|
-
|
10
|
+
def all(filters = nil)
|
11
|
+
if !filters
|
12
|
+
filters = {}
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
EntityList.new(@origin, request, ProjectUser, filters)
|
18
|
-
end
|
15
|
+
super
|
19
16
|
|
20
|
-
|
17
|
+
request = APIRequest.new(@origin, '/v1/projects/' + @projectID.to_s() + '/users', 'GET')
|
18
|
+
EntityList.new(@origin, request, ProjectUser, filters)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -1,39 +1,41 @@
|
|
1
|
-
|
1
|
+
module LeanTesting
|
2
|
+
class ProjectVersionsHandler < LeanTesting::EntityHandler
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
def initialize(origin, projectID)
|
5
|
+
super(origin)
|
5
6
|
|
6
|
-
|
7
|
-
|
7
|
+
@projectID = projectID
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
10
|
+
def create(fields)
|
11
|
+
super
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
supports = {
|
14
|
+
'number' => true
|
15
|
+
}
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
if enforce(fields, supports)
|
18
|
+
req = APIRequest.new(
|
19
|
+
@origin,
|
20
|
+
'/v1/projects/' + @projectID.to_s() + '/versions',
|
21
|
+
'POST',
|
22
|
+
{'params' => fields}
|
23
|
+
)
|
23
24
|
|
24
|
-
|
25
|
+
ProjectVersion.new(@origin, req.exec)
|
26
|
+
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def all(filters = nil)
|
30
|
+
if !filters
|
31
|
+
filters = {}
|
32
|
+
end
|
32
33
|
|
33
|
-
|
34
|
+
super
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
request = APIRequest.new(@origin, '/v1/projects/' + @projectID.to_s() + '/versions', 'GET')
|
37
|
+
EntityList.new(@origin, request, ProjectVersion, filters)
|
38
|
+
end
|
38
39
|
|
39
|
-
end
|
40
|
+
end
|
41
|
+
end
|
@@ -1,46 +1,48 @@
|
|
1
|
-
|
1
|
+
module LeanTesting
|
2
|
+
class ProjectsHandler < LeanTesting::EntityHandler
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
def create(fields)
|
5
|
+
super
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
supports = {
|
8
|
+
'name' => true,
|
9
|
+
'organization_id' => false
|
10
|
+
}
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
if enforce(fields, supports)
|
13
|
+
req = APIRequest.new(@origin, '/v1/projects', 'POST', {'params' => fields})
|
14
|
+
Project.new(@origin, req.exec)
|
15
|
+
end
|
14
16
|
end
|
15
|
-
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
def all(filters = nil)
|
19
|
+
if !filters
|
20
|
+
filters = {}
|
21
|
+
end
|
22
|
+
|
23
|
+
super
|
24
|
+
|
25
|
+
request = APIRequest.new(@origin, '/v1/projects', 'GET')
|
26
|
+
EntityList.new(@origin, request, Project, filters)
|
20
27
|
end
|
21
28
|
|
22
|
-
|
29
|
+
def allArchived(filters = nil)
|
30
|
+
if !filters
|
31
|
+
filters = {}
|
32
|
+
end
|
23
33
|
|
24
|
-
|
25
|
-
EntityList.new(@origin, request, Project, filters)
|
26
|
-
end
|
34
|
+
super
|
27
35
|
|
28
|
-
|
29
|
-
|
30
|
-
filters = {}
|
36
|
+
request = APIRequest.new(@origin, '/v1/projects/archived', 'GET')
|
37
|
+
EntityList.new(@origin, request, Project, filters)
|
31
38
|
end
|
32
39
|
|
33
|
-
|
40
|
+
def find(id)
|
41
|
+
super
|
34
42
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
def find(id)
|
40
|
-
super
|
43
|
+
req = APIRequest.new(@origin, '/v1/projects/' + id.to_s(), 'GET')
|
44
|
+
Project.new(@origin, req.exec)
|
45
|
+
end
|
41
46
|
|
42
|
-
req = APIRequest.new(@origin, '/v1/projects/' + id.to_s(), 'GET')
|
43
|
-
Project.new(@origin, req.exec)
|
44
47
|
end
|
45
|
-
|
46
|
-
end
|
48
|
+
end
|
@@ -1,14 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module LeanTesting
|
2
|
+
class UserHandler < LeanTesting::EntityHandler
|
3
|
+
attr_reader :organizations
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
def initialize(origin)
|
6
|
+
super
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
@organizations = UserOrganizationsHandler.new(origin)
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def getInformation
|
12
|
+
return (APIRequest.new(@origin, '/v1/me', 'GET')).exec
|
13
|
+
end
|
13
14
|
|
14
|
-
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,14 +1,16 @@
|
|
1
|
-
|
1
|
+
module LeanTesting
|
2
|
+
class UserOrganizationsHandler < LeanTesting::EntityHandler
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
def all(filters = nil)
|
5
|
+
if !filters
|
6
|
+
filters = {}
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
+
super
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
request = APIRequest.new(@origin, '/v1/me/organizations', 'GET')
|
12
|
+
EntityList.new(@origin, request, UserOrganization, filters)
|
13
|
+
end
|
13
14
|
|
14
|
-
end
|
15
|
+
end
|
16
|
+
end
|
data/tests/APIRequestTest.rb
CHANGED
@@ -6,43 +6,43 @@ require_relative '../lib/leantesting'
|
|
6
6
|
class APIRequestTest < MiniTest::Test
|
7
7
|
|
8
8
|
def test_APIRequestDefined
|
9
|
-
APIRequest
|
9
|
+
LeanTesting::APIRequest
|
10
10
|
end
|
11
11
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
15
|
def test_APIRequestInstanceNonStrEndpoint
|
16
|
-
assert_raises SDKInvalidArgException do
|
17
|
-
APIRequest.new(LeanTesting::Client.new, 12751, 'GET')
|
16
|
+
assert_raises LeanTesting::SDKInvalidArgException do
|
17
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, 12751, 'GET')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
def test_APIRequestInstanceNonStrMethod
|
21
|
-
assert_raises SDKInvalidArgException do
|
22
|
-
APIRequest.new(LeanTesting::Client.new, '/', 1233)
|
21
|
+
assert_raises LeanTesting::SDKInvalidArgException do
|
22
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, '/', 1233)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
def test_APIRequestInstanceSupportedMethod
|
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')
|
26
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, '/', 'GET')
|
27
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, '/', 'POST')
|
28
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, '/', 'PUT')
|
29
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, '/', 'DELETE')
|
30
30
|
end
|
31
31
|
def test_APIRequestInstanceNonSupportedMethod
|
32
|
-
assert_raises SDKInvalidArgException do
|
33
|
-
APIRequest.new(LeanTesting::Client.new, '/', 'XXX')
|
32
|
+
assert_raises LeanTesting::SDKInvalidArgException do
|
33
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, '/', 'XXX')
|
34
34
|
end
|
35
35
|
end
|
36
36
|
def test_APIRequestInstanceNonArrOpts
|
37
|
-
assert_raises SDKInvalidArgException do
|
38
|
-
APIRequest.new(LeanTesting::Client.new, '/', 'GET', 12123)
|
37
|
+
assert_raises LeanTesting::SDKInvalidArgException do
|
38
|
+
LeanTesting::APIRequest.new(LeanTesting::Client.new, '/', 'GET', 12123)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
def test_APIRequestBadJSONResponse
|
42
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
42
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
43
43
|
req.expects(:call).returns({'data'=> '{xxxxxxxxx', 'status'=> 200})
|
44
44
|
|
45
|
-
ex = assert_raises SDKBadJSONResponseException do
|
45
|
+
ex = assert_raises LeanTesting::SDKBadJSONResponseException do
|
46
46
|
req.exec
|
47
47
|
end
|
48
48
|
assert_match '{xxxxxxxxx', ex.message
|
@@ -54,19 +54,19 @@ class APIRequestTest < MiniTest::Test
|
|
54
54
|
|
55
55
|
|
56
56
|
def test_APIRequestExpectedStatus
|
57
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
57
|
+
req = LeanTesting::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(LeanTesting::Client.new, '/any/method', 'POST')
|
61
|
+
req = LeanTesting::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(LeanTesting::Client.new, '/any/method', 'PUT')
|
65
|
+
req = LeanTesting::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(LeanTesting::Client.new, '/any/method', 'DELETE')
|
69
|
+
req = LeanTesting::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,10 +77,10 @@ class APIRequestTest < MiniTest::Test
|
|
77
77
|
|
78
78
|
|
79
79
|
def test_APIRequestUnexpectedStatusDELETE
|
80
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'DELETE')
|
80
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'DELETE')
|
81
81
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 200})
|
82
82
|
|
83
|
-
ex = assert_raises SDKErrorResponseException do
|
83
|
+
ex = assert_raises LeanTesting::SDKErrorResponseException do
|
84
84
|
req.exec
|
85
85
|
end
|
86
86
|
assert_match 'XXXyyy', ex.message
|
@@ -91,28 +91,28 @@ class APIRequestTest < MiniTest::Test
|
|
91
91
|
|
92
92
|
|
93
93
|
def test_APIRequestUnexpectedStatusGET
|
94
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
94
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
95
95
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 204})
|
96
96
|
|
97
|
-
ex = assert_raises SDKErrorResponseException do
|
97
|
+
ex = assert_raises LeanTesting::SDKErrorResponseException do
|
98
98
|
req.exec
|
99
99
|
end
|
100
100
|
assert_match 'XXXyyy', ex.message
|
101
101
|
end
|
102
102
|
def test_APIRequestUnexpectedStatusPOST
|
103
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'POST')
|
103
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'POST')
|
104
104
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 204})
|
105
105
|
|
106
|
-
ex = assert_raises SDKErrorResponseException do
|
106
|
+
ex = assert_raises LeanTesting::SDKErrorResponseException do
|
107
107
|
req.exec
|
108
108
|
end
|
109
109
|
assert_match 'XXXyyy', ex.message
|
110
110
|
end
|
111
111
|
def test_APIRequestUnexpectedStatusPUT
|
112
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'PUT')
|
112
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'PUT')
|
113
113
|
req.expects(:call).returns({'data'=> 'XXXyyy', 'status'=> 204})
|
114
114
|
|
115
|
-
ex = assert_raises SDKErrorResponseException do
|
115
|
+
ex = assert_raises LeanTesting::SDKErrorResponseException do
|
116
116
|
req.exec
|
117
117
|
end
|
118
118
|
assert_match 'XXXyyy', ex.message
|
@@ -122,28 +122,28 @@ class APIRequestTest < MiniTest::Test
|
|
122
122
|
|
123
123
|
|
124
124
|
def test_APIRequestEmptyRespGET
|
125
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
125
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'GET')
|
126
126
|
req.expects(:call).returns({'data'=> '{}', 'status'=> 200})
|
127
127
|
|
128
|
-
ex = assert_raises SDKUnexpectedResponseException do
|
128
|
+
ex = assert_raises LeanTesting::SDKUnexpectedResponseException do
|
129
129
|
req.exec
|
130
130
|
end
|
131
131
|
assert_match 'Empty', ex.message
|
132
132
|
end
|
133
133
|
def test_APIRequestEmptyRespPOST
|
134
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'POST')
|
134
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'POST')
|
135
135
|
req.expects(:call).returns({'data'=> '{}', 'status'=> 200})
|
136
136
|
|
137
|
-
ex = assert_raises SDKUnexpectedResponseException do
|
137
|
+
ex = assert_raises LeanTesting::SDKUnexpectedResponseException do
|
138
138
|
req.exec
|
139
139
|
end
|
140
140
|
assert_match 'Empty', ex.message
|
141
141
|
end
|
142
142
|
def test_APIRequestEmptyRespPUT
|
143
|
-
req = APIRequest.new(LeanTesting::Client.new, '/any/method', 'PUT')
|
143
|
+
req = LeanTesting::APIRequest.new(LeanTesting::Client.new, '/any/method', 'PUT')
|
144
144
|
req.expects(:call).returns({'data'=> '{}', 'status'=> 200})
|
145
145
|
|
146
|
-
ex = assert_raises SDKUnexpectedResponseException do
|
146
|
+
ex = assert_raises LeanTesting::SDKUnexpectedResponseException do
|
147
147
|
req.exec
|
148
148
|
end
|
149
149
|
assert_match 'Empty', ex.message
|