lazylead 0.2.0 → 0.4.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/.0pdd.yml +4 -1
- data/.circleci/config.yml +14 -4
- data/.docker/Dockerfile +5 -4
- data/.docker/vcs.dockerfile +10 -0
- data/.docs/accuracy.md +107 -0
- data/.docs/accuracy_email.jpg +0 -0
- data/.docs/accuracy_jira_comment.jpg +0 -0
- data/.docs/duedate_expired.md +92 -0
- data/.docs/propagate_down.md +89 -0
- data/.pdd +1 -1
- data/.rubocop.yml +7 -1
- data/.rultor.yml +2 -2
- data/.simplecov +0 -6
- data/bin/lazylead +13 -5
- data/lazylead.gemspec +4 -16
- data/lib/lazylead/cc.rb +180 -0
- data/lib/lazylead/cli/app.rb +4 -3
- data/lib/lazylead/exchange.rb +15 -2
- data/lib/lazylead/home.rb +38 -0
- data/lib/lazylead/log.rb +30 -8
- data/lib/lazylead/model.rb +60 -22
- data/lib/lazylead/opts.rb +68 -0
- data/lib/lazylead/postman.rb +15 -15
- data/lib/lazylead/schedule.rb +6 -4
- data/lib/lazylead/smtp.rb +1 -1
- data/lib/lazylead/system/fake.rb +1 -1
- data/lib/lazylead/system/jira.rb +51 -12
- data/lib/lazylead/system/synced.rb +2 -1
- data/lib/lazylead/task/accuracy/accuracy.rb +140 -0
- data/lib/lazylead/task/accuracy/affected_build.rb +43 -0
- data/lib/lazylead/task/accuracy/requirement.rb +40 -0
- data/lib/lazylead/task/alert.rb +8 -6
- data/lib/lazylead/task/confluence_ref.rb +4 -3
- data/lib/lazylead/task/echo.rb +4 -0
- data/lib/lazylead/task/fix_version.rb +10 -6
- data/lib/lazylead/task/missing_comment.rb +7 -5
- data/lib/lazylead/task/propagate_down.rb +126 -0
- data/lib/lazylead/task/savepoint.rb +58 -0
- data/lib/lazylead/task/touch.rb +102 -0
- data/lib/lazylead/version.rb +1 -1
- data/lib/messages/accuracy.erb +118 -0
- data/lib/messages/due_date_expired.erb +8 -7
- data/lib/messages/illegal_fixversion_change.erb +9 -8
- data/lib/messages/missing_comment.erb +10 -9
- data/lib/messages/savepoint.erb +43 -0
- data/lib/messages/svn_touch.erb +147 -0
- data/readme.md +35 -32
- data/test/lazylead/cc_test.rb +153 -0
- data/test/lazylead/cli/app_test.rb +3 -4
- data/test/lazylead/exchange_test.rb +22 -2
- data/test/lazylead/model_test.rb +14 -3
- data/test/lazylead/opts_test.rb +70 -0
- data/test/lazylead/postman_test.rb +57 -0
- data/test/lazylead/smtp_test.rb +1 -1
- data/test/lazylead/system/jira_test.rb +35 -1
- data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
- data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
- data/test/lazylead/task/assignee_alert_test.rb +2 -2
- data/test/lazylead/task/duedate_test.rb +48 -22
- data/test/lazylead/task/fix_version_test.rb +9 -6
- data/test/lazylead/task/missing_comment_test.rb +11 -9
- data/test/lazylead/task/propagate_down_test.rb +88 -0
- data/test/lazylead/task/savepoint_test.rb +51 -0
- data/test/lazylead/task/touch_test.rb +63 -0
- data/upgrades/sqlite/001-install-main-lazylead-tables.sql +0 -1
- data/upgrades/sqlite/999.testdata.sql +5 -1
- metadata +41 -176
- data/todo.yml +0 -6
@@ -0,0 +1,153 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 Yurii Dubinka
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"),
|
9
|
+
# to deal in the Software without restriction, including without limitation
|
10
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
# and/or sell copies of the Software, and to permit persons to whom
|
12
|
+
# the Software is furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included
|
15
|
+
# in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
23
|
+
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
require_relative "../test"
|
26
|
+
require_relative "../../lib/lazylead/log"
|
27
|
+
require_relative "../../lib/lazylead/cli/app"
|
28
|
+
require_relative "../../lib/lazylead/cc"
|
29
|
+
require_relative "../../lib/lazylead/system/jira"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
class CcTest < Lazylead::Test
|
33
|
+
test "plain cc detected as text" do
|
34
|
+
assert Lazylead::CC.new.plain? "a@fake.com,b@fake.com"
|
35
|
+
end
|
36
|
+
test "plain cc not found in text" do
|
37
|
+
refute Lazylead::CC.new.plain? "justatext.com,eeeee.com"
|
38
|
+
end
|
39
|
+
test "plain cc detected as object" do
|
40
|
+
assert Lazylead::CC.new.recognized? Lazylead::PlainCC.new("a@fake.com")
|
41
|
+
end
|
42
|
+
test "cc is incorrect" do
|
43
|
+
refute Lazylead::CC.new.recognized? key: "value"
|
44
|
+
end
|
45
|
+
test "cc is not found in hash" do
|
46
|
+
assert Lazylead::CC.new.undefined? key: "value"
|
47
|
+
end
|
48
|
+
test "cc type is blank" do
|
49
|
+
assert Lazylead::CC.new.undefined? "type" => " "
|
50
|
+
end
|
51
|
+
end
|
52
|
+
class PlainCcTest < Lazylead::Test
|
53
|
+
test "cc has valid email" do
|
54
|
+
assert_equal "a@fake.com", Lazylead::PlainCC.new("a@fake.com").cc.first
|
55
|
+
end
|
56
|
+
|
57
|
+
test "cc has valid email despite on additional spaces" do
|
58
|
+
assert_equal "a@fake.com", Lazylead::PlainCC.new("a@fake.com ").cc.first
|
59
|
+
end
|
60
|
+
|
61
|
+
test "cc has valid email despite on unexpected symbols" do
|
62
|
+
assert_equal "a@f.com", Lazylead::PlainCC.new("a@f.com, , -").cc.first
|
63
|
+
end
|
64
|
+
|
65
|
+
test "cc has valid emails" do
|
66
|
+
assert_equal %w[a@fake.com b@fake.com c@fake.com],
|
67
|
+
Lazylead::PlainCC.new("a@fake.com,b@fake.com,c@fake.com").cc
|
68
|
+
end
|
69
|
+
|
70
|
+
test "cc count is correct" do
|
71
|
+
assert_equal 3, Lazylead::PlainCC.new("a@f.com,b@f.com,c@f.com").count
|
72
|
+
end
|
73
|
+
|
74
|
+
test "cc behaves as array" do
|
75
|
+
assert_equal %w[A@f.com B@f.com C@f.com],
|
76
|
+
Lazylead::PlainCC.new("a@f.com,b@f.com,c@f.com")
|
77
|
+
.map(&:capitalize)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
class PredefinedCcTest < Lazylead::Test
|
82
|
+
test "predefined cc has valid emails" do
|
83
|
+
assert_entries(
|
84
|
+
{
|
85
|
+
"jdbc" => %w[j@fake.com],
|
86
|
+
"jvm" => %w[j@fake.com v@fake.com]
|
87
|
+
},
|
88
|
+
PredefinedCC.new(
|
89
|
+
"jdbc" => "j@fake.com ",
|
90
|
+
"jvm" => "j@fake.com,,v@fake.com"
|
91
|
+
).to_h
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
test "all predefined cc are valid emails" do
|
96
|
+
assert_equal %w[j@fake.com v@fake.com m@fake.com],
|
97
|
+
PredefinedCC.new(
|
98
|
+
"jdbc" => "j@fake.com ",
|
99
|
+
"jvm" => "j@fake.com,,v@fake.com,-, ,m@fake.com"
|
100
|
+
).cc
|
101
|
+
end
|
102
|
+
|
103
|
+
test "cc by key is found" do
|
104
|
+
assert_equal %w[j@fake.com],
|
105
|
+
PredefinedCC.new(
|
106
|
+
"jdbc" => "j@fake.com ",
|
107
|
+
"jvm" => "j@fake.com,,v@fake.com,-, ,m@fake.com"
|
108
|
+
)["jdbc"]
|
109
|
+
end
|
110
|
+
|
111
|
+
# @todo #/DEV The test has performance issue. Jira has no way how to take
|
112
|
+
# the emails for leads quickly due to https://bit.ly/2ZRZlWc.
|
113
|
+
# Thus, for each component we need to find a lead, and only then detect
|
114
|
+
# lead's email, thus, its took few minutes for huge projects.
|
115
|
+
test "cc by component is found" do
|
116
|
+
skip "Disabled due to performance issue with Jira API"
|
117
|
+
assert_equal ENV["cc_email"],
|
118
|
+
ComponentCC.new(
|
119
|
+
ENV["cc_project"],
|
120
|
+
Jira.new(
|
121
|
+
{
|
122
|
+
username: ENV["JIRA_USER"],
|
123
|
+
password: ENV["JIRA_PASS"],
|
124
|
+
site: ENV["JIRA_URL"],
|
125
|
+
context_path: ""
|
126
|
+
}
|
127
|
+
)
|
128
|
+
).cc(ENV["cc_component"])
|
129
|
+
end
|
130
|
+
|
131
|
+
test "detect plain cc" do
|
132
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
133
|
+
home: ".",
|
134
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
135
|
+
vcs4sql: "upgrades/sqlite",
|
136
|
+
testdata: true
|
137
|
+
)
|
138
|
+
assert_equal %w[leelakenny@mail.com maciecrane@mail.com],
|
139
|
+
ORM::Task.find(3).detect_cc(nil)["cc"].cc
|
140
|
+
end
|
141
|
+
|
142
|
+
test "detect complex cc by predefined component" do
|
143
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
144
|
+
home: ".",
|
145
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
146
|
+
vcs4sql: "upgrades/sqlite",
|
147
|
+
testdata: true
|
148
|
+
)
|
149
|
+
assert_equal %w[tom@fake.com mike@fake.com],
|
150
|
+
ORM::Task.find(165).detect_cc(nil)["cc"].cc("jvm", "jdbc")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -31,7 +31,7 @@ module Lazylead
|
|
31
31
|
module CLI
|
32
32
|
class AppTest < Lazylead::SqliteTest
|
33
33
|
test "LL database structure installed successfully" do
|
34
|
-
CLI::App.new(Log
|
34
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
35
35
|
home: ".",
|
36
36
|
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
37
37
|
vcs4sql: "upgrades/sqlite"
|
@@ -39,15 +39,14 @@ module Lazylead
|
|
39
39
|
assert_tables "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
40
40
|
systems: %w[id properties],
|
41
41
|
teams: %w[id name properties],
|
42
|
-
tasks: %w[id name cron system action team_id
|
43
|
-
enabled properties]
|
42
|
+
tasks: %w[id name cron system action team_id enabled properties]
|
44
43
|
assert_fk "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
45
44
|
%w[tasks team_id teams id],
|
46
45
|
%w[tasks system systems id]
|
47
46
|
end
|
48
47
|
|
49
48
|
test "activesupport is activated for access to domain entities" do
|
50
|
-
CLI::App.new(Log
|
49
|
+
CLI::App.new(Log.new, Schedule.new(cling: false)).run(
|
51
50
|
home: ".",
|
52
51
|
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
53
52
|
vcs4sql: "upgrades/sqlite",
|
@@ -25,6 +25,7 @@
|
|
25
25
|
require_relative "../test"
|
26
26
|
require_relative "../../lib/lazylead/log"
|
27
27
|
require_relative "../../lib/lazylead/salt"
|
28
|
+
require_relative "../../lib/lazylead/home"
|
28
29
|
require_relative "../../lib/lazylead/exchange"
|
29
30
|
require_relative "../../lib/lazylead/system/jira"
|
30
31
|
|
@@ -35,7 +36,7 @@ module Lazylead
|
|
35
36
|
"exchange_user",
|
36
37
|
"exchange_password",
|
37
38
|
"exchange_to"
|
38
|
-
Exchange.new(Log
|
39
|
+
Exchange.new(Log.new, NoSalt.new).send(
|
39
40
|
to: ENV["exchange_to"],
|
40
41
|
tickets: NoAuthJira.new("https://jira.spring.io")
|
41
42
|
.issues("key = DATAJDBC-480"),
|
@@ -51,7 +52,7 @@ module Lazylead
|
|
51
52
|
"enc_exchange_psw",
|
52
53
|
"enc_exchange_to"
|
53
54
|
Exchange.new(
|
54
|
-
Log
|
55
|
+
Log.new,
|
55
56
|
Salt.new("exchange_salt"),
|
56
57
|
"exchange_url" => ENV["exchange_url"],
|
57
58
|
"exchange_user" => ENV["enc_exchange_usr"],
|
@@ -64,5 +65,24 @@ module Lazylead
|
|
64
65
|
"template" => "lib/messages/due_date_expired.erb"
|
65
66
|
)
|
66
67
|
end
|
68
|
+
|
69
|
+
test "exchange email with attachment" do
|
70
|
+
skip "No MS Exchange credentials provided" unless env? "exchange_url",
|
71
|
+
"exchange_user",
|
72
|
+
"exchange_password",
|
73
|
+
"exchange_to"
|
74
|
+
Exchange.new(
|
75
|
+
Log.new,
|
76
|
+
Salt.new("exchange_salt"),
|
77
|
+
"exchange_url" => ENV["exchange_url"],
|
78
|
+
"exchange_user" => ENV["enc_exchange_usr"],
|
79
|
+
"exchange_password" => ENV["enc_exchange_psw"]
|
80
|
+
).send(
|
81
|
+
to: ENV["exchange_to"],
|
82
|
+
"attachments" => "readme.md",
|
83
|
+
"subject" => "[LL] Attachments",
|
84
|
+
"template" => "lib/messages/savepoint.erb"
|
85
|
+
)
|
86
|
+
end
|
67
87
|
end
|
68
88
|
end
|
data/test/lazylead/model_test.rb
CHANGED
@@ -31,7 +31,7 @@ require_relative "../../lib/lazylead/schedule"
|
|
31
31
|
module Lazylead
|
32
32
|
class OrmTest < Lazylead::SqliteTest
|
33
33
|
test "convert column to json" do
|
34
|
-
CLI::App.new(Log
|
34
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
35
35
|
home: ".",
|
36
36
|
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
37
37
|
vcs4sql: "upgrades/sqlite",
|
@@ -42,7 +42,7 @@ module Lazylead
|
|
42
42
|
|
43
43
|
test "env properties injected" do
|
44
44
|
ENV["usr"] = "Mike"
|
45
|
-
CLI::App.new(Log
|
45
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
46
46
|
home: ".",
|
47
47
|
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
48
48
|
vcs4sql: "upgrades/sqlite",
|
@@ -53,7 +53,7 @@ module Lazylead
|
|
53
53
|
end
|
54
54
|
|
55
55
|
test "postman initiated through orm" do
|
56
|
-
CLI::App.new(Log
|
56
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
57
57
|
home: ".",
|
58
58
|
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
59
59
|
vcs4sql: "upgrades/sqlite",
|
@@ -61,5 +61,16 @@ module Lazylead
|
|
61
61
|
)
|
62
62
|
assert_kind_of Lazylead::Postman, ORM::Task.find(5).postman
|
63
63
|
end
|
64
|
+
|
65
|
+
test "task properties are using ENV variables" do
|
66
|
+
ENV["key171"] = "value"
|
67
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
68
|
+
home: ".",
|
69
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
70
|
+
vcs4sql: "upgrades/sqlite",
|
71
|
+
testdata: true
|
72
|
+
)
|
73
|
+
assert_equal "value", ORM::Task.find(171).props["envkey"]
|
74
|
+
end
|
64
75
|
end
|
65
76
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 Yurii Dubinka
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"),
|
9
|
+
# to deal in the Software without restriction, including without limitation
|
10
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
# and/or sell copies of the Software, and to permit persons to whom
|
12
|
+
# the Software is furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included
|
15
|
+
# in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
23
|
+
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
require_relative "../test"
|
26
|
+
require_relative "../../lib/lazylead/opts"
|
27
|
+
|
28
|
+
module Lazylead
|
29
|
+
class OptsTest < Lazylead::Test
|
30
|
+
test "able to read by symbol" do
|
31
|
+
assert_equal "1", Opts.new(one: "1", two: "2")[:one]
|
32
|
+
end
|
33
|
+
|
34
|
+
test "able to read by key" do
|
35
|
+
assert_equal "1", Opts.new("one" => "1", two: "2")["one"]
|
36
|
+
end
|
37
|
+
|
38
|
+
test "able to write by key" do
|
39
|
+
opts = Opts.new
|
40
|
+
opts["key"] = "value"
|
41
|
+
assert_equal "value", opts["key"]
|
42
|
+
end
|
43
|
+
|
44
|
+
test "has jira defaults" do
|
45
|
+
assert_entries(
|
46
|
+
{
|
47
|
+
max_results: 50
|
48
|
+
},
|
49
|
+
Opts.new.jira_defaults
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
test "split and trim" do
|
54
|
+
assert_equal %w[one two three],
|
55
|
+
Opts.new("text" => " one,two ,three, ,\n").slice("text", ",")
|
56
|
+
end
|
57
|
+
|
58
|
+
test "blank for null value cases" do
|
59
|
+
assert Opts.new("one" => "1", "two" => nil).blank? "two"
|
60
|
+
end
|
61
|
+
|
62
|
+
test "to hash" do
|
63
|
+
assert_kind_of Hash, Opts.new("one" => "1", "two" => nil).to_h
|
64
|
+
end
|
65
|
+
|
66
|
+
test "except keys" do
|
67
|
+
assert_equal 1, Opts.new("one" => "1", "two" => "2").except("one").size
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2019-2020 Yurii Dubinka
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"),
|
9
|
+
# to deal in the Software without restriction, including without limitation
|
10
|
+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
11
|
+
# and/or sell copies of the Software, and to permit persons to whom
|
12
|
+
# the Software is furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included
|
15
|
+
# in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
22
|
+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
23
|
+
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
|
25
|
+
require_relative "../test"
|
26
|
+
require_relative "../../lib/lazylead/log"
|
27
|
+
require_relative "../../lib/lazylead/salt"
|
28
|
+
require_relative "../../lib/lazylead/smtp"
|
29
|
+
require_relative "../../lib/lazylead/postman"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
class PostmanTest < Lazylead::Test
|
33
|
+
test "email with attachment" do
|
34
|
+
skip "No postman credentials provided" unless env? "LL_SMTP_HOST",
|
35
|
+
"LL_SMTP_PORT",
|
36
|
+
"LL_SMTP_USER",
|
37
|
+
"LL_SMTP_PASS",
|
38
|
+
"LL_SMTP_TO",
|
39
|
+
"LL_SMTP_FROM"
|
40
|
+
Smtp.new(
|
41
|
+
Log.new,
|
42
|
+
NoSalt.new,
|
43
|
+
smtp_host: ENV["LL_SMTP_HOST"],
|
44
|
+
smtp_port: ENV["LL_SMTP_PORT"],
|
45
|
+
smtp_user: ENV["LL_SMTP_USER"],
|
46
|
+
smtp_pass: ENV["LL_SMTP_PASS"]
|
47
|
+
).enable
|
48
|
+
Postman.new.send(
|
49
|
+
"to" => ENV["LL_SMTP_TO"],
|
50
|
+
"from" => ENV["LL_SMTP_FROM"],
|
51
|
+
"attachments" => ["readme.md"],
|
52
|
+
"subject" => "[LL] Attachments",
|
53
|
+
"template" => "lib/messages/savepoint.erb"
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/test/lazylead/smtp_test.rb
CHANGED
@@ -48,7 +48,7 @@ module Lazylead
|
|
48
48
|
test "email has been sent to the remote server" do
|
49
49
|
skip "Not implemented yet" unless env? "LL_SMTP_HOST", "LL_SMTP_USER"
|
50
50
|
Smtp.new(
|
51
|
-
Log
|
51
|
+
Log.new, NoSalt.new,
|
52
52
|
smtp_host: ENV["LL_SMTP_HOST"],
|
53
53
|
smtp_port: ENV["LL_SMTP_PORT"],
|
54
54
|
smtp_user: ENV["LL_SMTP_USER"],
|
@@ -40,7 +40,7 @@ module Lazylead
|
|
40
40
|
|
41
41
|
test "found issue by jira (ORM)" do
|
42
42
|
skip "No Jira credentials provided" unless env? "jsi_usr", "jsi_psw"
|
43
|
-
CLI::App.new(Log
|
43
|
+
CLI::App.new(Log.new, NoSchedule.new).run(
|
44
44
|
home: ".",
|
45
45
|
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
46
46
|
vcs4sql: "upgrades/sqlite",
|
@@ -114,5 +114,39 @@ module Lazylead
|
|
114
114
|
.first
|
115
115
|
.status
|
116
116
|
end
|
117
|
+
|
118
|
+
test "issue has 1 field" do
|
119
|
+
assert_equal 1,
|
120
|
+
NoAuthJira.new("https://jira.spring.io")
|
121
|
+
.issues("key='DATAJDBC-480'", fields: ["summary"])
|
122
|
+
.first
|
123
|
+
.fields
|
124
|
+
.size
|
125
|
+
end
|
126
|
+
|
127
|
+
test "make an jira comment" do
|
128
|
+
issue = Struct.new(:comment) do
|
129
|
+
def comments
|
130
|
+
self
|
131
|
+
end
|
132
|
+
|
133
|
+
def build
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
def save!(body)
|
138
|
+
self[:comment] = body
|
139
|
+
end
|
140
|
+
end.new
|
141
|
+
Issue.new(issue, Fake.new).post("Hi there!")
|
142
|
+
assert_equal "Hi there!", issue.comment[:body]
|
143
|
+
end
|
144
|
+
|
145
|
+
test "search by limit in 1 issue" do
|
146
|
+
assert_equal 1,
|
147
|
+
NoAuthJira.new("https://jira.spring.io")
|
148
|
+
.issues("key in (DATAJDBC-480, DATAJDBC-500)", max_results: "1")
|
149
|
+
.size
|
150
|
+
end
|
117
151
|
end
|
118
152
|
end
|