howlingmine-client 0.1.4 → 0.1.5
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.
- data/History.txt +5 -0
- data/Manifest.txt +1 -0
- data/lib/howlingmine.rb +1 -1
- data/lib/howlingmine/client.rb +13 -0
- data/lib/howlingmine/issue.rb +6 -2
- data/test/client_test.rb +66 -0
- data/test/issue_test.rb +9 -0
- metadata +3 -1
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/lib/howlingmine.rb
CHANGED
data/lib/howlingmine/client.rb
CHANGED
@@ -26,6 +26,19 @@ module HowlingMine
|
|
26
26
|
def find
|
27
27
|
RestClient.post("#{HowlingMine::Config.protocol}://#{HowlingMine::Config.host}:#{HowlingMine::Config.port}/howling_mine/find", HowlingMine::Config.params.merge(:api_key => HowlingMine::Config.api_key))
|
28
28
|
end
|
29
|
+
|
30
|
+
def count_issues
|
31
|
+
RestClient.post("#{HowlingMine::Config.protocol}://#{HowlingMine::Config.host}:#{HowlingMine::Config.port}/howling_mine/count_issues", HowlingMine::Config.params.merge(:api_key => HowlingMine::Config.api_key))
|
32
|
+
end
|
33
|
+
|
34
|
+
def plugin_version
|
35
|
+
RestClient.post("#{HowlingMine::Config.protocol}://#{HowlingMine::Config.host}:#{HowlingMine::Config.port}/howling_mine/plugin_version",
|
36
|
+
HowlingMine::Config.params.merge(:api_key => HowlingMine::Config.api_key))
|
37
|
+
end
|
38
|
+
|
39
|
+
def count_projects
|
40
|
+
RestClient.post("#{HowlingMine::Config.protocol}://#{HowlingMine::Config.host}:#{HowlingMine::Config.port}/howling_mine/count_issues", HowlingMine::Config.params.merge(:api_key => HowlingMine::Config.api_key))
|
41
|
+
end
|
29
42
|
end
|
30
43
|
end
|
31
44
|
|
data/lib/howlingmine/issue.rb
CHANGED
@@ -17,6 +17,10 @@ module HowlingMine
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.count
|
21
|
+
HowlingMine::Client.count_issues.to_i
|
22
|
+
end
|
23
|
+
|
20
24
|
def save
|
21
25
|
client = HowlingMine::Client
|
22
26
|
params = {
|
@@ -62,7 +66,7 @@ module HowlingMine
|
|
62
66
|
def self.last
|
63
67
|
find :last
|
64
68
|
end
|
65
|
-
|
69
|
+
|
66
70
|
def status
|
67
71
|
c = HowlingMine::Client
|
68
72
|
HowlingMine::Config.params.merge!(:issue_id => id)
|
@@ -121,4 +125,4 @@ module HowlingMine
|
|
121
125
|
end
|
122
126
|
end
|
123
127
|
end
|
124
|
-
end
|
128
|
+
end
|
data/test/client_test.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require "#{File.join(File.dirname(__FILE__),'../lib/howlingmine.rb')}"
|
3
|
+
|
4
|
+
class TestClient < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
FileUtils.cp 'redmine_test_files/redmine.db','/opt/redmine-0.8/db/redmine.db'
|
8
|
+
HowlingMine::Config.host = 'redmine.local'
|
9
|
+
HowlingMine::Config.port = 80 # default
|
10
|
+
HowlingMine::Config.use_ssl = false # default
|
11
|
+
HowlingMine::Config.project = 'howlingmine'
|
12
|
+
HowlingMine::Config.tracker = 'Bug' # default
|
13
|
+
HowlingMine::Config.api_key = 'FboVJFYVg84avd2dfL3Y'
|
14
|
+
end
|
15
|
+
|
16
|
+
def teardown
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_api_key
|
20
|
+
HowlingMine::Config.api_key = '0'
|
21
|
+
|
22
|
+
assert_nothing_raised do
|
23
|
+
HowlingMine::Config.api_key = 'FboVJFYVg84avd2dfL3Y'
|
24
|
+
HowlingMine::Client.plugin_version
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_save_issue
|
29
|
+
client = HowlingMine::Client
|
30
|
+
params = {
|
31
|
+
:subject => 'no subject',
|
32
|
+
:description => 'desc',
|
33
|
+
:author => 'none',
|
34
|
+
}
|
35
|
+
|
36
|
+
HowlingMine::Config.params.merge!(params)
|
37
|
+
|
38
|
+
assert_nothing_raised do
|
39
|
+
response = client.new_issue
|
40
|
+
assert response.to_i == 1
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_count_projects
|
45
|
+
assert HowlingMine::Client.count_projects.to_i == 0
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_count_issues
|
49
|
+
assert HowlingMine::Client.count_issues.to_i == 0
|
50
|
+
client = HowlingMine::Client
|
51
|
+
params = {
|
52
|
+
:subject => 'no subject',
|
53
|
+
:description => 'desc',
|
54
|
+
:author => 'none',
|
55
|
+
}
|
56
|
+
|
57
|
+
HowlingMine::Config.params.merge!(params)
|
58
|
+
client.new_issue
|
59
|
+
assert HowlingMine::Client.count_issues.to_i == 1
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_plugin_version
|
63
|
+
assert HowlingMine::Client.plugin_version =~ /(\d.?)+/
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
data/test/issue_test.rb
CHANGED
@@ -146,5 +146,14 @@ class TestIssue < Test::Unit::TestCase
|
|
146
146
|
HowlingMine::Issue.find 2
|
147
147
|
end
|
148
148
|
end
|
149
|
+
|
150
|
+
def test_count
|
151
|
+
assert HowlingMine::Issue.count == 0
|
152
|
+
issue = HowlingMine::Issue.new
|
153
|
+
issue.subject = 'issue number 1'
|
154
|
+
issue.description = 'description'
|
155
|
+
assert issue.save
|
156
|
+
issue = HowlingMine::Issue.count == 1
|
157
|
+
end
|
149
158
|
|
150
159
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: howlingmine-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Rubio
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- redmine_test_files/database.yml
|
68
68
|
- redmine_test_files/redmine.db
|
69
69
|
- script/console
|
70
|
+
- test/client_test.rb
|
70
71
|
- test/issue_test.rb
|
71
72
|
has_rdoc: true
|
72
73
|
homepage: http://github.com/rubiojr/howlingmine-client
|
@@ -98,4 +99,5 @@ signing_key:
|
|
98
99
|
specification_version: 3
|
99
100
|
summary: Client library for the Howling Mine Server
|
100
101
|
test_files:
|
102
|
+
- test/client_test.rb
|
101
103
|
- test/issue_test.rb
|