mantis_ruby 0.0.1 → 0.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/lib/mantis_ruby.rb +161 -135
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5e2d89fd0388c35e9024e85bf8a529838bf08ab
|
4
|
+
data.tar.gz: 66821a29e20664d941ec60cf84b373bd62c5d2c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5b31a514447693a99430ab4676764f5368f0b347e182feadd90ea3ba4fef555d175331b175470e19b72d0cf72e0d8fc89d7c9897e5970c7be5e662062674c1e
|
7
|
+
data.tar.gz: 0c364ffc94d319e68c69f42fc056dc16c927e5db9845949b2ec0fb1e2922b3b7ba2f8f10516c58128bb1322900761d75a748550b33d629bc6ec37167a2e32015
|
data/lib/mantis_ruby.rb
CHANGED
@@ -2,150 +2,176 @@ require 'httpclient'
|
|
2
2
|
require 'savon'
|
3
3
|
|
4
4
|
class MantisRuby
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
def self.issue_in_format(issue={})
|
6
|
+
({id: 1,
|
7
|
+
status: "new",
|
8
|
+
summary: "First issue",
|
9
|
+
actual: "Actual result",
|
10
|
+
expected: "Expected Result",
|
11
|
+
screenresolution: "Give if possible",
|
12
|
+
description: ("Description \r\n ---------------- \r\n Actual Result: \r\n Your actual desult will be shown here. \r\n ---------------- \r\n Expected Result:\r\n Expected Result will be shown here \r\n ---------------- \r\n Screen Resolution:\r\n Screen resolution will come here."),
|
13
|
+
:steps_to_reproduce => "Step to reproduce",
|
14
|
+
:additional_information => "additional_information",
|
15
|
+
category: "General" ,
|
16
|
+
:add_note=> "bug note",
|
17
|
+
resolution: "screenresolution",
|
18
|
+
severity: "10",
|
19
|
+
reproducibility: "Reproducibility",
|
20
|
+
priority: "10",
|
21
|
+
file_location: 'http://dimomohit.com/assets/logo-a40f75aaa7c1d5a2a3f99e8da5e8159c353e407ffdc1c29dfabe43e4c7e8bd41.png',
|
22
|
+
content_type: 'png',
|
23
|
+
project: {id: "project_id",
|
24
|
+
name: "project_name"
|
25
|
+
}
|
26
|
+
}).merge(issue)
|
27
|
+
end
|
28
|
+
def self.hi
|
29
|
+
puts "Hello developer! Welcome to Mantis Ruby Gem."
|
30
|
+
puts "You can use MantisRuby.help any time to get the help."
|
31
|
+
end
|
8
32
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
@wsdl=wsdl
|
13
|
-
puts connect_to_tracker
|
14
|
-
end
|
33
|
+
def self.help
|
34
|
+
|
35
|
+
end
|
15
36
|
|
16
|
-
|
17
|
-
|
18
|
-
|
37
|
+
def initialize(username,password,wsdl)
|
38
|
+
@username=username
|
39
|
+
@password=password
|
40
|
+
@wsdl=wsdl
|
41
|
+
connect_to_tracker
|
42
|
+
end
|
19
43
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
44
|
+
def connect_to_tracker
|
45
|
+
@client = Savon.client(wsdl: "#{@wsdl}/api/soap/mantisconnect.php?wsdl" )
|
46
|
+
end
|
24
47
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
JSON.parse(@response.to_json)["mc_projects_get_user_accessible_response"]["return"]
|
30
|
-
end
|
48
|
+
def check_version
|
49
|
+
client=connect_to_tracker
|
50
|
+
client.call(:mc_version).to_hash[:mc_version_response][:return]
|
51
|
+
end
|
31
52
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
push_bug(bug)
|
39
|
-
set_attachment(bug)
|
40
|
-
set_priority(bug)
|
41
|
-
end
|
42
|
-
# self.is_busy = false
|
43
|
-
# self.save
|
44
|
-
end
|
53
|
+
def get_user_accessible_projects
|
54
|
+
client=connect_to_tracker
|
55
|
+
@response=client.call(:mc_projects_get_user_accessible,message: {username: @username,
|
56
|
+
password: @password})
|
57
|
+
(@response.to_hash)[:mc_projects_get_user_accessible_response][:return]
|
58
|
+
end
|
45
59
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
resolution: bug.screenresolution,
|
58
|
-
severity: ((bug.btype=="Feature") ? "10" : ((bug.btype=="Technical") ? "60" : ((bug.btype=="GUI") ? "40" : ((bug.btype=="Functional") ? "60" : "50") ))),
|
59
|
-
reproducibility: ((bug.freq == "Every Time") ? "10" : ((bug.freq == "Frequently") ? "10" : ((bug.freq == "Rarely") ? "50" : ((bug.freq == "Once") ? "30" : "N/A" )))),
|
60
|
-
priority: ((bug.priority==1) ? "50" : ((bug.priority==2) ? "40" : ((bug.priority==3) ? "30" : ((bug.priority==4) ? "20" : "10" ) ))),
|
61
|
-
project: {id: self.project_id,
|
62
|
-
name: self.project_name
|
63
|
-
}
|
64
|
-
}
|
65
|
-
}
|
66
|
-
)
|
67
|
-
return_id=JSON.parse(@response.to_json)["mc_issue_add_response"]["return"]
|
68
|
-
@response
|
69
|
-
end
|
60
|
+
def push_all_bugs(bugs)
|
61
|
+
client=connect_to_tracker
|
62
|
+
bugs.each do |bug|
|
63
|
+
push_bug(bug)
|
64
|
+
begin
|
65
|
+
set_attachment(bug)
|
66
|
+
rescue
|
67
|
+
end
|
68
|
+
# set_priority(bug)
|
69
|
+
end
|
70
|
+
end
|
70
71
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
72
|
+
def push_bug(bug,project_id,project_name)
|
73
|
+
client=connect_to_tracker
|
74
|
+
@response = client.call(:mc_issue_add, message: {username: @username,
|
75
|
+
password: @password,
|
76
|
+
issue: {status: "#{bug[:status].blank? ? 'new' : bug[:status]}",
|
77
|
+
summary: bug[:summary],
|
78
|
+
description: ("#{bug[:description]} \r\n ---------------- \r\n Actual Result: \r\n #{bug[:actual]} \r\n ---------------- \r\n Expected Result:\r\n #{bug[:expected]} \r\n ---------------- \r\n Screen Resolution:\r\n #{bug[:screenresolution]}"),
|
79
|
+
"steps_to_reproduce" => "#{bug[:description]}",
|
80
|
+
"additional_information" => "Actual Result: \r\n #{bug[:actual]} \r\n ---------------- \r\n Expected Result:\r\n #{bug[:expected]} \r\n ---------------- \r\n Screen Resolution:\r\n #{bug[:screenresolution]}",
|
81
|
+
category: "#{bug[:category].blank? ? 'General' : bug[:category]}" ,
|
82
|
+
"add_note"=> bug[:add_note],
|
83
|
+
resolution: bug[:screenresolution],
|
84
|
+
severity: "#{bug[:severity].blank? ? '10' : bug[:severity]}",
|
85
|
+
reproducibility: "#{bug[:reproducibility].blank? ? '10' : bug[:reproducibility]}",
|
86
|
+
priority: "#{bug[:priority].blank? ? '10' : bug[:priority]}",
|
87
|
+
project: {id: project_id,
|
88
|
+
name: project_name
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
)
|
93
|
+
(@response.to_hash)[:mc_issue_add_response][:return]
|
94
|
+
end
|
93
95
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
96
|
+
def update_bug(bug,project_id,project_name)
|
97
|
+
client=connect_to_tracker
|
98
|
+
@response = client.call(:mc_issue_update, message: {username: @username,
|
99
|
+
password: @password,
|
100
|
+
"issueId" => bug[:id],
|
101
|
+
issue: {status: "#{bug[:status].blank? ? 'new' : bug[:status]}",
|
102
|
+
summary: bug[:summary],
|
103
|
+
description: ("#{bug[:description]} \r\n ---------------- \r\n Actual Result: \r\n #{bug[:actual]} \r\n ---------------- \r\n Expected Result:\r\n #{bug[:expected]} \r\n ---------------- \r\n Screen Resolution:\r\n #{bug[:screenresolution]}"),
|
104
|
+
"steps_to_reproduce" => "#{bug[:description]}",
|
105
|
+
"additional_information" => "Actual Result: \r\n #{bug[:actual]} \r\n ---------------- \r\n Expected Result:\r\n #{bug[:expected]} \r\n ---------------- \r\n Screen Resolution:\r\n #{bug[:screenresolution]}",
|
106
|
+
category: "#{bug[:category].blank? ? 'General' : bug[:category]}" ,
|
107
|
+
"add_note"=> bug[:add_note],
|
108
|
+
resolution: bug[:screenresolution],
|
109
|
+
severity: "#{bug[:severity].blank? ? '10' : bug[:severity]}",
|
110
|
+
reproducibility: "#{bug[:reproducibility].blank? ? '10' : bug[:reproducibility]}",
|
111
|
+
priority: "#{bug[:priority].blank? ? '10' : bug[:priority]}",
|
112
|
+
project: {id: project_id,
|
113
|
+
name: project_name}}})
|
114
|
+
begin
|
115
|
+
set_attachment(bug)
|
116
|
+
rescue
|
117
|
+
end
|
118
|
+
# set_priority(bug)
|
119
|
+
@response.to_hash
|
120
|
+
end
|
104
121
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
puts return_id
|
116
|
-
@response
|
117
|
-
end
|
122
|
+
def set_note(bug,map_bug_id) ########Working
|
123
|
+
client=connect_to_tracker
|
124
|
+
client.call(:mc_issue_note_add,
|
125
|
+
message: {username: @username,
|
126
|
+
password: @password,
|
127
|
+
"issue_id"=>map_bug_id,
|
128
|
+
note: {text: bug.add_note }
|
129
|
+
}
|
130
|
+
).to_hash
|
131
|
+
end
|
118
132
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
133
|
+
def set_tag(bug,map_bug_id,tags=[])
|
134
|
+
client=connect_to_tracker
|
135
|
+
client.call(:mc_issue_set_tags,
|
136
|
+
message: {username: @username,
|
137
|
+
password: @password,
|
138
|
+
"issue_id"=>map_bug_id,
|
139
|
+
tags: tags ##Array of tags
|
140
|
+
}
|
141
|
+
).to_hash
|
142
|
+
end
|
129
143
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
144
|
+
def set_priority(bug,map_bug_id,comment) ########Working
|
145
|
+
client=connect_to_tracker
|
146
|
+
client.call(:mc_issue_note_add,
|
147
|
+
message: {username: @username,
|
148
|
+
password: @password,
|
149
|
+
"issue_id"=>map_bug_id,
|
150
|
+
note: {text: comment }
|
151
|
+
}
|
152
|
+
).to_hash
|
153
|
+
end
|
154
|
+
|
155
|
+
def set_attachment(bug,map_bug_id=bug[:id],file_location=bug[:file_location])
|
156
|
+
unless file_location.blank?
|
157
|
+
client=connect_to_tracker
|
158
|
+
begin
|
159
|
+
file_name="bug_#{Time.now.to_i}.#{bug[:content_type]}"
|
160
|
+
sf = open(file_location, 'rb') { |io| io.read }
|
161
|
+
sfile=Base64::encode64(sf)
|
162
|
+
client.call(:mc_issue_attachment_add,
|
163
|
+
message: {username: @username,
|
164
|
+
password: @password,
|
165
|
+
"issue_id"=> map_bug_id,
|
166
|
+
name: file_name,
|
167
|
+
"file_type" => bug[:content_type],
|
168
|
+
"content"=> sfile
|
169
|
+
}
|
170
|
+
).to_hash
|
171
|
+
rescue Exception => e
|
172
|
+
puts "File not submitted : #{e}"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
151
177
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mantis_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimo Mohit
|
@@ -37,9 +37,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
37
37
|
version: '0'
|
38
38
|
requirements: []
|
39
39
|
rubyforge_project:
|
40
|
-
rubygems_version: 2.4.
|
40
|
+
rubygems_version: 2.4.8
|
41
41
|
signing_key:
|
42
42
|
specification_version: 4
|
43
43
|
summary: Mantis Testing tool with Ruby
|
44
44
|
test_files: []
|
45
|
-
has_rdoc:
|