jirarest2 0.0.3

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.
@@ -0,0 +1,21 @@
1
+ require "minitest/autorun"
2
+ require "connect"
3
+ require "credentials"
4
+
5
+ class TestConnect < MiniTest::Unit::TestCase
6
+ def setup
7
+ cred = Credentials.new("http://localhost:2990/jira/rest/api/2/","test","1234")
8
+ @con = Connect.new(cred)
9
+ end
10
+
11
+
12
+ def test_executeGET
13
+ assert "projects", @con.execute("Get","issue/createmeta/","").result["expand"]
14
+ end
15
+
16
+ def test_executePOST
17
+ query={"jql"=>"project = MFTP", "startAt"=>0, "maxResults"=>4 }
18
+ assert 4, @con.execute("Post","search/",query).result["maxResults"]
19
+ end
20
+
21
+ end
@@ -0,0 +1,38 @@
1
+ require "minitest/autorun"
2
+ require "jirarest2"
3
+
4
+ class TestCredentials < MiniTest::Unit::TestCase
5
+ def setup
6
+ @cred = Credentials.new("https://localhost:2990","username","password")
7
+ @credc = Credentials.new("https://localhost:2990","username","password")
8
+ end
9
+
10
+ def testInitialize
11
+ assert_instance_of(Credentials, Credentials.new("https://localhost:2990","username","password") )
12
+ assert_raises(Jirarest2::NotAnURLError) {
13
+ Credentials.new("localhost:2990","username","password")
14
+ }
15
+ assert_equal "https://localhost:2990", @cred.connecturl
16
+ assert_equal "username", @cred.username
17
+ assert_equal "password", @cred.password
18
+ end
19
+
20
+ def testSetURL
21
+ @credc.connecturl = "http://localhost:80"
22
+ assert_equal "http://localhost:80", @credc.connecturl
23
+ assert_raises(Jirarest2::NotAnURLError) {
24
+ @credc.connecturl = "localhost:80"
25
+ }
26
+ end
27
+
28
+ def testSetPassword
29
+ @credc.password = "1234"
30
+ assert_equal "1234", @credc.password
31
+ end
32
+
33
+ def testSetUsername
34
+ @credc.username = "test"
35
+ assert_equal "test", @credc.username
36
+ end
37
+
38
+ end
@@ -0,0 +1,51 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "jirarest2"
4
+
5
+ class TestIssue < MiniTest::Unit::TestCase
6
+ def setup
7
+ @credentials = Credentials.new("http://localhost:2990/jira/rest/api/2/","test","1234")
8
+ @existentIssue = Issue.new("MFTP","My issue type",@credentials)
9
+ end
10
+
11
+ def testNonExistentProject
12
+ assert_raises(Jirarest2::WrongProjectException) {
13
+ nonexistentProject = Issue.new("blubber","fasel",@credentials)
14
+ }
15
+ end
16
+
17
+ def testNonExistentIssuetype
18
+ assert_raises(Jirarest2::WrongIssuetypeException) {
19
+ nonexistentIssue = Issue.new("MFTP","fasel",@credentials)
20
+ }
21
+ end
22
+
23
+ def testExistent
24
+ assert_equal "My issue type", @existentIssue.issuetype
25
+ end
26
+
27
+ def test_get_requireds
28
+ req = @existentIssue.get_requireds
29
+ assert_equal true, req.include?("Summary")
30
+ end
31
+
32
+ def test_get_fieldnames
33
+ req = @existentIssue.get_fieldnames
34
+ assert_equal true, req.include?("Priority")
35
+ end
36
+
37
+ def test_jirahash
38
+ issue = @existentIssue
39
+ issue.set_field("Summary","Summary Text")
40
+ issue.set_field("Großes Text","My own text as well")
41
+ issue.set_field("Description","And a little bit for \n the big \n text field")
42
+ issue.set_field("Priority","Trivial")
43
+ issue.set_field("List select","Räuber")
44
+ issue.set_field("Multi Select",["Glocke","Kabale und Liebe"])
45
+ blankissue = issue.jirahash
46
+ assert blankissue
47
+ assert_equal "MFTP", blankissue["fields"]["project"]["key"]
48
+ assert_equal "Summary Text", issue.get_field("Summary")
49
+ end
50
+
51
+ end
@@ -0,0 +1,31 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "credentials"
4
+ require "connect"
5
+ require "services/issuelink"
6
+
7
+ class TestIssueLink < MiniTest::Unit::TestCase
8
+ def setup
9
+ cred = Credentials.new("http://localhost:2990/jira/rest/api/2/","test","1234")
10
+ @con = Connect.new(cred)
11
+ end
12
+
13
+ def test_link_issue
14
+ link = IssueLink.new(@con)
15
+ # check for right to link.
16
+ assert_raises(Jirarest2::AuthentificationError) {
17
+ link.link_issue("MFTP-6","SP-2","Blocks")
18
+ }
19
+ # check for bullshio issuelinktype
20
+ assert_raises(Jirarest2::ValueNotAllowedException) {
21
+ link.link_issue("SP-2","MFTP-6","Building")
22
+ }
23
+ # check for Basic link
24
+ assert "201",link.link_issue("SP-2","MFTP-6","Blocks").code
25
+ # Check for link type by name
26
+ assert "201",link.link_issue("SP-2","MFTP-6","clones").code
27
+ # Check for twisted "only onw way for links policy with jira", MFTP-6 to SP-3 would result in AuthError
28
+ assert "201",link.link_issue("MFTP-6","SP-3","is cloned by")
29
+ end
30
+
31
+ end
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "credentials"
4
+ require "connect"
5
+ require "services/issuelinktype"
6
+
7
+
8
+ class TestIssueLinkType < MiniTest::Unit::TestCase
9
+ def setup
10
+ cred = Credentials.new("http://localhost:2990/jira/rest/api/2/","test","1234")
11
+ @con = Connect.new(cred)
12
+ end
13
+
14
+ def test_name
15
+ singlelinktype = IssueLinkType.new(@con,"10000")
16
+ linktype = IssueLinkType.new(@con)
17
+ assert_equal "10000", singlelinktype.get["id"]
18
+ assert_equal ["Blocks", "outward"], singlelinktype.name("blocks")
19
+ assert_equal ["Blocks", "inward"], singlelinktype.name("is blocked by")
20
+ assert_equal ["Cloners", "outward"], linktype.name("clones")
21
+ assert_equal ["Cloners", "inward"], linktype.name("is cloned by")
22
+ assert_equal nil, linktype.name("unknown")
23
+ end
24
+
25
+ def test_internal_name?
26
+ singlelinktype = IssueLinkType.new(@con,"10000")
27
+ assert_equal false,singlelinktype.internal_name?("blocks")
28
+ assert_equal true, singlelinktype.internal_name?("Blocks")
29
+ linktype = IssueLinkType.new(@con)
30
+ assert_equal false,linktype.internal_name?("blocks")
31
+ assert_equal true, linktype.internal_name?("Cloners")
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,29 @@
1
+ require "minitest/autorun"
2
+ require "connect"
3
+ require "credentials"
4
+ require "jirarest2/result"
5
+
6
+ class TestResult < MiniTest::Unit::TestCase
7
+ def setup
8
+ cred = Credentials.new("http://localhost:2990/jira/rest/api/2/","test","1234")
9
+ @con = Connect.new(cred)
10
+ end
11
+
12
+ def test_code
13
+ assert "200", @con.execute("Get","issue/createmeta/","").code
14
+ end
15
+
16
+ def test_header
17
+ assert "test", @con.execute("Get","issue/createmeta/","").header["x-ausername"]
18
+ end
19
+
20
+ def test_result
21
+ assert "projects", @con.execute("Get","issue/createmeta/","").result["expand"]
22
+ end
23
+
24
+
25
+ def test_body
26
+ assert_match "http://localhost:2990/jira/rest/api/2/project", @con.execute("Get","issue/createmeta/","").body
27
+ end
28
+
29
+ end
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ require "minitest/autorun"
3
+ require "credentials"
4
+ require "connect"
5
+ require "services/watcher"
6
+
7
+ class TestWatcher < MiniTest::Unit::TestCase
8
+ def setup
9
+ cred = Credentials.new("http://localhost:2990/jira/rest/api/2/","test","1234")
10
+ @con = Connect.new(cred)
11
+ end
12
+
13
+ def test_get_watchers
14
+ watchers = Watcher.new(@con,"MFTP-7")
15
+ assert ["admin","cebit","test"], watchers.get_watchers
16
+ assert [], Watcher.new(@con,"MFTP-3")
17
+ end
18
+
19
+ def test_delete_watcher
20
+ watchers = Watcher.new(@con,"MFTP-7")
21
+ assert_raises(Jirarest2::AuthentificationError) {
22
+ watchers.remove_watcher("cebit")
23
+ }
24
+ end
25
+
26
+ def test_add_watcher
27
+ watcherna = Watcher.new(@con, "MFTP-2")
28
+ assert_raises(Jirarest2::AuthentificationError) {
29
+ watcherna.add_watcher("cebit")
30
+ }
31
+ watchers = Watcher.new(@con, "SP-1")
32
+ assert true, watchers.add_watcher("cebit")
33
+ end
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jirarest2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Cyril Bitterich
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - ! '-----BEGIN CERTIFICATE-----
13
+
14
+ MIIDPjCCAiagAwIBAgIBADANBgkqhkiG9w0BAQUFADBFMRcwFQYDVQQDDA5jZWJp
15
+
16
+ dC1qaXJhcmVzdDEWMBQGCgmSJomT8ixkARkWBmd1bm5ldDESMBAGCgmSJomT8ixk
17
+
18
+ ARkWAmRlMB4XDTEyMDcxNTIyMjkwOVoXDTEzMDcxNTIyMjkwOVowRTEXMBUGA1UE
19
+
20
+ AwwOY2ViaXQtamlyYXJlc3QxFjAUBgoJkiaJk/IsZAEZFgZndW5uZXQxEjAQBgoJ
21
+
22
+ kiaJk/IsZAEZFgJkZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMG0
23
+
24
+ uen60tSgNWxeFUcOtQbw0EbnUP06YbKykeFEWfEMPS7Idz5w3Q1tjJLHLK8Mj2qV
25
+
26
+ St5gZNvS049uXJI+fwNkxVXhqN8HvMYt0BkavCvEDbYws2wEh6nYwXhXYIuZIUFT
27
+
28
+ GJDk0tAKX7P4f32TxswGyDNs5oRvcRWOm/E+DtTQR/dfkibqh3xucAT4WdGQAJiP
29
+
30
+ nuLcJvXbX+RSzVFU28ai9SQ4M7UVe2cp7Ja8zDYnT/fkf5U0haceVe10KrEduz9S
31
+
32
+ lJYTT1Ot+/y3CqK1t3nW2w3MZ4P176PdVtvn1s8lN5RHTQY539ggEgQ/SSI6Pu3j
33
+
34
+ f2Rd6iBjtPbi45cwZmMCAwEAAaM5MDcwCQYDVR0TBAIwADAdBgNVHQ4EFgQUwLZr
35
+
36
+ yNLLDKqftwv41iZrrhaouw0wCwYDVR0PBAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IB
37
+
38
+ AQAHUqJDvNqiOxk8QlU9tt7by6J5ix8RlWf5OM2W01VsybEhnmMMEZuux+Dz6vUu
39
+
40
+ x11KG87FGOU2aOfUpuqrYLIc9oeOMIHMUrleUVDYR1dapIUnbUM8kbzbjsjViQf0
41
+
42
+ B5xEj6oWbGoCiv8ifVIRUXA21t77zQgZdG1rz+Irlvit5ealAnX22TFnxvNStvA2
43
+
44
+ BeygnEr+sRfYLTMMdHxTc5GIPIF1a3kJw9beanVDG5JLnisYer1k87h9P/Dp1Gpg
45
+
46
+ 7H17ynD9OULW1crZHQ4yyzLSjyAZiX5wDEPji4ZaBv0+bPNmsgjugpvLhrdUDk4b
47
+
48
+ SRdgcCyQhRn+gpC2X7XnwGgq
49
+
50
+ -----END CERTIFICATE-----
51
+
52
+ '
53
+ date: 2012-07-15 00:00:00.000000000 Z
54
+ dependencies:
55
+ - !ruby/object:Gem::Dependency
56
+ name: json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.6.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: 1.6.0
71
+ - !ruby/object:Gem::Dependency
72
+ name: highline
73
+ requirement: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: 1.1.0
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: 1.1.0
87
+ - !ruby/object:Gem::Dependency
88
+ name: hoe
89
+ requirement: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: 2.9.4
95
+ type: :development
96
+ prerelease: false
97
+ version_requirements: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: 2.9.4
103
+ description: ! "jirarest2 is yet another implementation of the JIRA(tm) REST api (
104
+ https://developer.atlassian.com/display/JIRADEV/JIRA+Remote+API+Reference ). \n
105
+ It is intended to be called within the shell to create and verify JIRA(tm) issues
106
+ fast without a browser.\n This implementation is still a for cry from others like
107
+ http://rubygems.org/gems/jira-ruby which required oauth authentification. \n Use
108
+ it at your own risk most of the API features are not implemented."
109
+ email:
110
+ - cebit-jirarest@gunnet.de
111
+ executables:
112
+ - create_issue.rb
113
+ extensions: []
114
+ extra_rdoc_files:
115
+ - History.txt
116
+ - Manifest.txt
117
+ - README.txt
118
+ files:
119
+ - .autotest
120
+ - GPLv3
121
+ - History.txt
122
+ - Manifest.txt
123
+ - README.md
124
+ - README.txt
125
+ - Rakefile
126
+ - bin/create_issue.rb
127
+ - header.copyright
128
+ - lib/config.rb
129
+ - lib/connect.rb
130
+ - lib/credentials.rb
131
+ - lib/exceptions.rb
132
+ - lib/issue.rb
133
+ - lib/issuelink.rb
134
+ - lib/jirarest2.rb
135
+ - lib/jirarest2/result.rb
136
+ - lib/services.rb
137
+ - lib/services/issuelink.rb
138
+ - lib/services/issuelinktype.rb
139
+ - lib/services/watcher.rb
140
+ - test/test_connect.rb
141
+ - test/test_credentials.rb
142
+ - test/test_issue.rb
143
+ - test/test_issuelink.rb
144
+ - test/test_issuelinktype.rb
145
+ - test/test_result.rb
146
+ - test/test_watcher.rb
147
+ - .gemtest
148
+ homepage: https://github.com/cybit/jirarest2#readme
149
+ licenses: []
150
+ post_install_message:
151
+ rdoc_options:
152
+ - --main
153
+ - README.txt
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ required_rubygems_version: !ruby/object:Gem::Requirement
163
+ none: false
164
+ requirements:
165
+ - - ! '>='
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project: jirarest2
170
+ rubygems_version: 1.8.24
171
+ signing_key:
172
+ specification_version: 3
173
+ summary: jirarest2 is yet another implementation of the JIRA(tm) REST api ( https://developer.atlassian.com/display/JIRADEV/JIRA+Remote+API+Reference
174
+ )
175
+ test_files:
176
+ - test/test_connect.rb
177
+ - test/test_issuelinktype.rb
178
+ - test/test_credentials.rb
179
+ - test/test_issue.rb
180
+ - test/test_result.rb
181
+ - test/test_issuelink.rb
182
+ - test/test_watcher.rb
Binary file