bicho 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +1 -45
- data/.rubocop_todo.yml +170 -0
- data/.travis.yml +4 -2
- data/README.md +1 -1
- data/bicho.gemspec +8 -7
- data/bin/bicho +2 -2
- data/lib/bicho/cli/command.rb +6 -6
- data/lib/bicho/client.rb +18 -21
- data/lib/bicho/query.rb +1 -1
- data/lib/bicho/version.rb +1 -1
- data/test/fixtures/777777.json +1 -0
- data/test/fixtures/vcr/bugzilla_gnome_org_312619.yml +185 -0
- data/test/fixtures/vcr/bugzilla_gnome_org_645150_history.yml +130 -0
- data/test/fixtures/vcr/bugzilla_gnome_org_679745_attachments.yml +118 -0
- data/test/fixtures/vcr/bugzilla_gnome_org_777777.yml +126 -0
- data/test/fixtures/vcr/bugzilla_gnome_org_777777_export.yml +300 -0
- data/test/fixtures/vcr/bugzilla_gnome_org_search_vala_resolved_basic_types.yml +705 -0
- data/test/fixtures/vcr/bugzilla_gnome_org_version.yml +58 -0
- data/test/fixtures/vcr/bugzilla_opensuse_org_version.yml +66 -0
- data/test/helper.rb +11 -0
- data/test/test_attachments.rb +15 -13
- data/test/test_export.rb +10 -148
- data/test/test_history.rb +8 -7
- data/test/test_query.rb +5 -3
- data/test/test_reports.rb +18 -14
- data/test/test_version.rb +12 -8
- metadata +69 -22
@@ -0,0 +1,58 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://bugzilla.gnome.org/xmlrpc.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '<?xml version="1.0" ?><methodCall><methodName>Bugzilla.version</methodName><params/></methodCall>
|
9
|
+
|
10
|
+
'
|
11
|
+
headers:
|
12
|
+
User-Agent:
|
13
|
+
- XMLRPC::Client (Ruby 2.5.0)
|
14
|
+
Content-Type:
|
15
|
+
- text/xml; charset=utf-8
|
16
|
+
Content-Length:
|
17
|
+
- '98'
|
18
|
+
Connection:
|
19
|
+
- keep-alive
|
20
|
+
Accept-Encoding:
|
21
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
|
+
Accept:
|
23
|
+
- "*/*"
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 200
|
27
|
+
message: OK
|
28
|
+
headers:
|
29
|
+
Date:
|
30
|
+
- Tue, 23 Oct 2018 10:54:56 GMT
|
31
|
+
Server:
|
32
|
+
- Apache/2.4.6 (Red Hat Enterprise Linux)
|
33
|
+
X-Xss-Protection:
|
34
|
+
- 1; mode=block
|
35
|
+
X-Frame-Options:
|
36
|
+
- SAMEORIGIN
|
37
|
+
X-Content-Type-Options:
|
38
|
+
- nosniff
|
39
|
+
Set-Cookie:
|
40
|
+
- Bugzilla_login_request_cookie=rGRBUqdGxW; path=/; secure; HttpOnly
|
41
|
+
Content-Length:
|
42
|
+
- '210'
|
43
|
+
Content-Type:
|
44
|
+
- text/xml
|
45
|
+
Soapserver:
|
46
|
+
- SOAP::Lite/Perl/1.1
|
47
|
+
Strict-Transport-Security:
|
48
|
+
- max-age=31536000; includeSubDomains; preload
|
49
|
+
Access-Control-Allow-Origin:
|
50
|
+
- https://bugzilla.gnome.org
|
51
|
+
Connection:
|
52
|
+
- close
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: <?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>version</name><value><string>4.4.13</string></value></member></struct></value></param></params></methodResponse>
|
56
|
+
http_version:
|
57
|
+
recorded_at: Tue, 23 Oct 2018 10:54:57 GMT
|
58
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,66 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://bugzilla.opensuse.org/xmlrpc.cgi
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '<?xml version="1.0" ?><methodCall><methodName>Bugzilla.version</methodName><params/></methodCall>
|
9
|
+
|
10
|
+
'
|
11
|
+
headers:
|
12
|
+
User-Agent:
|
13
|
+
- XMLRPC::Client (Ruby 2.5.0)
|
14
|
+
Content-Type:
|
15
|
+
- text/xml; charset=utf-8
|
16
|
+
Content-Length:
|
17
|
+
- '98'
|
18
|
+
Connection:
|
19
|
+
- keep-alive
|
20
|
+
Accept-Encoding:
|
21
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
|
+
Accept:
|
23
|
+
- "*/*"
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 200
|
27
|
+
message: OK
|
28
|
+
headers:
|
29
|
+
Date:
|
30
|
+
- Tue, 23 Oct 2018 10:54:58 GMT
|
31
|
+
Server:
|
32
|
+
- Apache
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31536000;includeSubDomains
|
35
|
+
X-Content-Type-Options:
|
36
|
+
- nosniff
|
37
|
+
X-Frame-Options:
|
38
|
+
- SAMEORIGIN
|
39
|
+
X-Xss-Protection:
|
40
|
+
- 1; mode=block
|
41
|
+
Content-Type:
|
42
|
+
- text/xml
|
43
|
+
Soapserver:
|
44
|
+
- SOAP::Lite/Perl/1.11
|
45
|
+
Set-Cookie:
|
46
|
+
- Bugzilla_login_request_cookie=jTyWtaThES; path=/; HttpOnly
|
47
|
+
- TbBx5iTmnWSKRFA@=v18jFvAA@@6d3; Domain=.opensuse.org; Path=/
|
48
|
+
- ZNPCQ003-32343300=1ea19fc3; Path=/; Domain=.opensuse.org
|
49
|
+
X-Mag:
|
50
|
+
- A816300EE4BD0ACF;5faca923;2440571;usrLkup->0;usrBase->0;getPRBefFind->0;getPRBefFind->0;PRAfterFind->0;openbugzilla_root;publicURL->0;openbugzilla;RwDis;FF1Endp->0;SendSoapStart->0;SendSoapExit->2;EvalII->2;CHd;FP2->2;WS=1ea19fc3;FP4->21;
|
51
|
+
Via:
|
52
|
+
- 1.1 bugzilla.opensuse.org (Access Gateway-ag-A816300EE4BD0ACF-2440571)
|
53
|
+
Keep-Alive:
|
54
|
+
- timeout=2, max=100
|
55
|
+
Connection:
|
56
|
+
- Keep-Alive
|
57
|
+
Transfer-Encoding:
|
58
|
+
- chunked
|
59
|
+
Vary:
|
60
|
+
- Accept-encoding
|
61
|
+
body:
|
62
|
+
encoding: ASCII-8BIT
|
63
|
+
string: <?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>version</name><value><string>4.4.12</string></value></member></struct></value></param></params></methodResponse>
|
64
|
+
http_version:
|
65
|
+
recorded_at: Tue, 23 Oct 2018 10:54:58 GMT
|
66
|
+
recorded_with: VCR 4.0.0
|
data/test/helper.rb
CHANGED
@@ -2,6 +2,8 @@ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
|
|
2
2
|
require 'minitest/autorun'
|
3
3
|
require 'minitest/reporters'
|
4
4
|
require 'minitest/mock'
|
5
|
+
require 'vcr'
|
6
|
+
|
5
7
|
Minitest::Reporters.use!(
|
6
8
|
Minitest::Reporters::ProgressReporter.new,
|
7
9
|
ENV,
|
@@ -13,3 +15,12 @@ if ENV['DEBUG']
|
|
13
15
|
Bicho::Logging.logger = Logger.new(STDERR)
|
14
16
|
Bicho::Logging.logger.level = Logger::DEBUG
|
15
17
|
end
|
18
|
+
|
19
|
+
def fixture(path)
|
20
|
+
File.absolute_path(File.join(File.dirname(__FILE__), '..', 'test', 'fixtures', path))
|
21
|
+
end
|
22
|
+
|
23
|
+
VCR.configure do |config|
|
24
|
+
config.cassette_library_dir = fixture('vcr')
|
25
|
+
config.hook_into :webmock
|
26
|
+
end
|
data/test/test_attachments.rb
CHANGED
@@ -4,23 +4,25 @@ require 'digest'
|
|
4
4
|
# Test for bug attachments
|
5
5
|
class AttachmentsTest < Minitest::Test
|
6
6
|
def test_client_get_attachments
|
7
|
-
|
7
|
+
VCR.use_cassette('bugzilla.gnome.org_679745_attachments') do
|
8
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.gnome.org')
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
attachments = Bicho.client.get_attachments(679745)
|
11
|
+
assert_kind_of(Array, attachments)
|
12
|
+
assert !attachments.empty?
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
attachments.each do |attachment|
|
15
|
+
assert_kind_of(Bicho::Attachment, attachment)
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
next unless attachment.id == 329690
|
18
|
+
assert_equal('text/plain', attachment.content_type)
|
19
|
+
assert_equal(8559, attachment.size)
|
20
|
+
assert_equal('user-accounts: use Password Login instead of Automatic Login',
|
21
|
+
attachment.summary)
|
21
22
|
|
22
|
-
|
23
|
-
|
23
|
+
assert_equal('80c4665205bcbd2b90ea920eff21f29988d8fc85f36c293a65fa3dad52d19354',
|
24
|
+
Digest::SHA256.hexdigest(attachment.data.read))
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
data/test/test_export.rb
CHANGED
@@ -1,155 +1,17 @@
|
|
1
1
|
require_relative 'helper'
|
2
2
|
|
3
|
-
BUG_ES_EXPORT = <<-EOF.freeze
|
4
|
-
{
|
5
|
-
"priority": "Normal",
|
6
|
-
"blocks": [
|
7
|
-
|
8
|
-
],
|
9
|
-
"creator": "kekun.plazas@laposte.net",
|
10
|
-
"last_change_time": "2017-02-22 20:48:43 UTC",
|
11
|
-
"is_cc_accessible": true,
|
12
|
-
"keywords": [
|
13
|
-
|
14
|
-
],
|
15
|
-
"cc": [
|
16
|
-
"kekun.plazas@laposte.net",
|
17
|
-
"mcatanzaro@gnome.org"
|
18
|
-
],
|
19
|
-
"url": "",
|
20
|
-
"assigned_to": "gnome-games-maint@gnome.bugs",
|
21
|
-
"see_also": [
|
22
|
-
|
23
|
-
],
|
24
|
-
"groups": [
|
25
|
-
|
26
|
-
],
|
27
|
-
"id": 777777,
|
28
|
-
"creation_time": "2017-01-26 08:46:00 UTC",
|
29
|
-
"whiteboard": "",
|
30
|
-
"qa_contact": "gnome-games-maint@gnome.bugs",
|
31
|
-
"depends_on": [
|
32
|
-
|
33
|
-
],
|
34
|
-
"resolution": "FIXED",
|
35
|
-
"classification": "Core",
|
36
|
-
"op_sys": "Linux",
|
37
|
-
"status": "RESOLVED",
|
38
|
-
"cf_gnome_target": "---",
|
39
|
-
"cf_gnome_version": "---",
|
40
|
-
"summary": "Game Boy games not detected",
|
41
|
-
"is_open": false,
|
42
|
-
"platform": "Other",
|
43
|
-
"severity": "normal",
|
44
|
-
"flags": [
|
45
|
-
|
46
|
-
],
|
47
|
-
"version": "unspecified",
|
48
|
-
"component": "general",
|
49
|
-
"is_creator_accessible": true,
|
50
|
-
"product": "gnome-games",
|
51
|
-
"is_confirmed": true,
|
52
|
-
"target_milestone": "---",
|
53
|
-
"history": [
|
54
|
-
{
|
55
|
-
"who": "kekun.plazas@laposte.net",
|
56
|
-
"timestamp": "2017-01-26 09:03:10 UTC",
|
57
|
-
"changes": [
|
58
|
-
{
|
59
|
-
"removed": "",
|
60
|
-
"added": "kekun.plazas@laposte.net",
|
61
|
-
"field_name": "cc"
|
62
|
-
}
|
63
|
-
]
|
64
|
-
},
|
65
|
-
{
|
66
|
-
"who": "kekun.plazas@laposte.net",
|
67
|
-
"timestamp": "2017-01-26 09:05:34 UTC",
|
68
|
-
"changes": [
|
69
|
-
{
|
70
|
-
"attachment_id": 344292,
|
71
|
-
"removed": "0",
|
72
|
-
"added": "1",
|
73
|
-
"field_name": "attachments.isobsolete"
|
74
|
-
}
|
75
|
-
]
|
76
|
-
},
|
77
|
-
{
|
78
|
-
"who": "kekun.plazas@laposte.net",
|
79
|
-
"timestamp": "2017-01-26 09:06:09 UTC",
|
80
|
-
"changes": [
|
81
|
-
{
|
82
|
-
"removed": "NEW",
|
83
|
-
"added": "RESOLVED",
|
84
|
-
"field_name": "status"
|
85
|
-
},
|
86
|
-
{
|
87
|
-
"removed": "",
|
88
|
-
"added": "FIXED",
|
89
|
-
"field_name": "resolution"
|
90
|
-
}
|
91
|
-
]
|
92
|
-
},
|
93
|
-
{
|
94
|
-
"who": "kekun.plazas@laposte.net",
|
95
|
-
"timestamp": "2017-01-26 09:06:13 UTC",
|
96
|
-
"changes": [
|
97
|
-
{
|
98
|
-
"attachment_id": 344293,
|
99
|
-
"removed": "none",
|
100
|
-
"added": "committed",
|
101
|
-
"field_name": "attachments.gnome_attachment_status"
|
102
|
-
}
|
103
|
-
]
|
104
|
-
},
|
105
|
-
{
|
106
|
-
"who": "kekun.plazas@laposte.net",
|
107
|
-
"timestamp": "2017-01-26 09:06:16 UTC",
|
108
|
-
"changes": [
|
109
|
-
{
|
110
|
-
"attachment_id": 344294,
|
111
|
-
"removed": "none",
|
112
|
-
"added": "committed",
|
113
|
-
"field_name": "attachments.gnome_attachment_status"
|
114
|
-
}
|
115
|
-
]
|
116
|
-
},
|
117
|
-
{
|
118
|
-
"who": "kekun.plazas@laposte.net",
|
119
|
-
"timestamp": "2017-01-26 11:06:35 UTC",
|
120
|
-
"changes": [
|
121
|
-
{
|
122
|
-
"attachment_id": 344303,
|
123
|
-
"removed": "none",
|
124
|
-
"added": "committed",
|
125
|
-
"field_name": "attachments.gnome_attachment_status"
|
126
|
-
}
|
127
|
-
]
|
128
|
-
},
|
129
|
-
{
|
130
|
-
"who": "mcatanzaro@gnome.org",
|
131
|
-
"timestamp": "2017-02-22 20:40:19 UTC",
|
132
|
-
"changes": [
|
133
|
-
{
|
134
|
-
"removed": "",
|
135
|
-
"added": "mcatanzaro@gnome.org",
|
136
|
-
"field_name": "cc"
|
137
|
-
}
|
138
|
-
]
|
139
|
-
}
|
140
|
-
],
|
141
|
-
"resolution_time": "2017-01-26 09:06:09 UTC"
|
142
|
-
}
|
143
|
-
EOF
|
144
|
-
|
145
3
|
# Test small utilities
|
146
4
|
class ExportTest < Minitest::Test
|
147
5
|
def test_to_json
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
6
|
+
VCR.use_cassette('bugzilla.gnome.org_777777_export') do
|
7
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.gnome.org')
|
8
|
+
bug = Bicho.client.get_bug(777777)
|
9
|
+
File.write('777777.json', Bicho::Export.to_json(bug))
|
10
|
+
|
11
|
+
assert_equal(
|
12
|
+
JSON.dump(JSON.load(File.read(fixture('777777.json')))),
|
13
|
+
Bicho::Export.to_json(bug)
|
14
|
+
)
|
15
|
+
end
|
154
16
|
end
|
155
17
|
end
|
data/test/test_history.rb
CHANGED
@@ -3,16 +3,17 @@ require_relative 'helper'
|
|
3
3
|
# Test for bug history
|
4
4
|
class HistoryTest < Minitest::Test
|
5
5
|
def test_basic_history
|
6
|
-
|
6
|
+
VCR.use_cassette('bugzilla.gnome.org_645150_history') do
|
7
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.gnome.org')
|
7
8
|
|
8
|
-
|
9
|
+
bug = Bicho.client.get_bug(645150)
|
10
|
+
history = bug.history
|
9
11
|
|
10
|
-
|
12
|
+
assert !history.empty?
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
assert c.timestamp.to_time.to_i > 0
|
14
|
+
history.each do |c|
|
15
|
+
assert c.timestamp.to_time.to_i > 0
|
16
|
+
end
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
data/test/test_query.rb
CHANGED
@@ -14,10 +14,12 @@ class QueryTest < Minitest::Test
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
VCR.use_cassette('bugzilla.gnome.org_search_vala_resolved_basic_types') do
|
18
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.gnome.org')
|
18
19
|
|
19
|
-
|
20
|
-
|
20
|
+
ret = Bicho::Bug.where.product('vala').status('resolved').component('Basic Types').each.to_a
|
21
|
+
assert ret.collect(&:id).include?(645_150)
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
def test_query_addition_of_attributes
|
data/test/test_reports.rb
CHANGED
@@ -3,23 +3,27 @@ require_relative 'helper'
|
|
3
3
|
# Test reports on bugs
|
4
4
|
class ReportsTest < Minitest::Test
|
5
5
|
def test_resolution_date
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
VCR.use_cassette('bugzilla.gnome.org_777777') do
|
7
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.gnome.org')
|
8
|
+
bug = Bicho.client.get_bug(777777)
|
9
|
+
ts = Bicho::Reports.resolution_time(bug)
|
10
|
+
assert_equal(Time.parse('2017-01-26 09:06:09 UTC'), ts)
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
14
|
def test_ranges_with_statuses
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
VCR.use_cassette('bugzilla.gnome.org_312619') do
|
16
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.gnome.org')
|
17
|
+
bug = Bicho.client.get_bug(312619)
|
18
|
+
ranges = Bicho::Reports.ranges_with_statuses(bug, 'NEEDINFO')
|
19
|
+
assert_equal(
|
20
|
+
[Time.parse('2005-12-31 21:56:36 UTC')..Time.parse('2006-04-11 19:22:41 UTC')], ranges
|
21
|
+
)
|
19
22
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
ranges = Bicho::Reports.ranges_with_statuses(bug, 'NEEDINFO', 'RESOLVED')
|
24
|
+
assert_equal(Time.parse('2005-12-31 21:56:36 UTC')..Time.parse('2006-04-11 19:22:41 UTC'), ranges[0])
|
25
|
+
assert_equal(Time.parse('2006-04-11 19:22:41 UTC'), ranges[1].begin)
|
26
|
+
assert(Time.now - ranges[1].end < 60)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
data/test/test_version.rb
CHANGED
@@ -3,18 +3,22 @@ require_relative 'helper'
|
|
3
3
|
# Test getting the version of the Bugzilla API
|
4
4
|
class VersionTest < Minitest::Test
|
5
5
|
def test_version_gnome
|
6
|
-
|
6
|
+
VCR.use_cassette('bugzilla.gnome.org_version') do
|
7
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.gnome.org')
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
ret = Bicho.client.version
|
10
|
+
# https://bugzilla.gnome.org/ is at 4.4.12 as of Jun/2016
|
11
|
+
assert_match(/4.4/, ret)
|
12
|
+
end
|
11
13
|
end
|
12
14
|
|
13
15
|
def test_version_suse
|
14
|
-
|
16
|
+
VCR.use_cassette('bugzilla.opensuse.org_version') do
|
17
|
+
Bicho.client = Bicho::Client.new('https://bugzilla.opensuse.org')
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
ret = Bicho.client.version
|
20
|
+
# https://bugzilla.suse.com is at 4.4.6 as of Jan/2015
|
21
|
+
assert_match(/4.4/, ret)
|
22
|
+
end
|
19
23
|
end
|
20
24
|
end
|