lazylead 0.2.0 → 0.3.0
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/.circleci/config.yml +12 -4
- data/.docker/Dockerfile +5 -4
- data/.docker/vcs.dockerfile +10 -0
- data/.docs/duedate_expired.md +92 -0
- data/.docs/propagate_down.md +89 -0
- data/.rubocop.yml +1 -1
- data/.rultor.yml +2 -2
- data/.simplecov +0 -6
- data/bin/lazylead +4 -2
- data/lazylead.gemspec +2 -14
- data/lib/lazylead/cc.rb +174 -0
- data/lib/lazylead/exchange.rb +14 -1
- data/lib/lazylead/home.rb +38 -0
- data/lib/lazylead/model.rb +23 -11
- data/lib/lazylead/postman.rb +14 -14
- data/lib/lazylead/system/fake.rb +1 -1
- data/lib/lazylead/system/jira.rb +42 -5
- data/lib/lazylead/task/propagate_down.rb +118 -0
- data/lib/lazylead/task/savepoint.rb +58 -0
- data/lib/lazylead/version.rb +1 -1
- 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/readme.md +18 -16
- data/test/lazylead/cc_test.rb +133 -0
- data/test/lazylead/cli/app_test.rb +1 -2
- data/test/lazylead/exchange_test.rb +20 -0
- data/test/lazylead/model_test.rb +11 -0
- data/test/lazylead/postman_test.rb +57 -0
- data/test/lazylead/task/duedate_test.rb +16 -0
- data/test/lazylead/task/propagate_down_test.rb +86 -0
- data/test/lazylead/task/savepoint_test.rb +51 -0
- data/upgrades/sqlite/001-install-main-lazylead-tables.sql +0 -1
- data/upgrades/sqlite/999.testdata.sql +4 -1
- metadata +19 -171
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
2
3
|
<head>
|
3
4
|
<style>
|
4
5
|
/* CSS styles taken from https://github.com/yegor256/tacit */
|
@@ -87,14 +88,14 @@
|
|
87
88
|
|
88
89
|
<p>The <span style='font-weight:bold'>'Fix Version'</span> for the following
|
89
90
|
ticket(s) changed by not authorized person(s):</p>
|
90
|
-
<table>
|
91
|
+
<table summary="ticket(s) where fix version changed">
|
91
92
|
<tr>
|
92
|
-
<th>Key</th>
|
93
|
-
<th>Priority</th>
|
94
|
-
<th>When</th>
|
95
|
-
<th>Who</th>
|
96
|
-
<th>Reporter</th>
|
97
|
-
<th>Summary</th>
|
93
|
+
<th id="key">Key</th>
|
94
|
+
<th id="priority">Priority</th>
|
95
|
+
<th id="when">When</th>
|
96
|
+
<th id="who">Who</th>
|
97
|
+
<th id="reporter">Reporter</th>
|
98
|
+
<th id="summary">Summary</th>
|
98
99
|
</tr>
|
99
100
|
<% versions.each do |v| %>
|
100
101
|
<tr>
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
2
3
|
<head>
|
3
4
|
<style> /* CSS styles taken from https://github.com/yegor256/tacit */
|
4
5
|
th {
|
@@ -95,15 +96,15 @@
|
|
95
96
|
<p>Hi <%= addressee %>,</p>
|
96
97
|
|
97
98
|
<p>The following ticket(s) has missing <%= details %>:</p>
|
98
|
-
<table>
|
99
|
+
<table summary="ticket(s) without expected comment">
|
99
100
|
<tr>
|
100
|
-
<th>Key</th>
|
101
|
-
<th>Due date</th>
|
102
|
-
<th>Priority</th>
|
103
|
-
<th>Assignee</th>
|
104
|
-
<th>Reporter</th>
|
105
|
-
<th>Summary</th>
|
106
|
-
<th>Last comments</th>
|
101
|
+
<th id="key">Key</th>
|
102
|
+
<th id="duedate">Due date</th>
|
103
|
+
<th id="priority">Priority</th>
|
104
|
+
<th id="assignee">Assignee</th>
|
105
|
+
<th id="reporter">Reporter</th>
|
106
|
+
<th id="summary">Summary</th>
|
107
|
+
<th id="comments">Last comments</th>
|
107
108
|
</tr>
|
108
109
|
<% comments.each do |comment| %>
|
109
110
|
<tr>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<style> /* CSS styles taken from https://github.com/yegor256/tacit */
|
5
|
+
a {
|
6
|
+
color: #275a90;
|
7
|
+
text-decoration: none
|
8
|
+
}
|
9
|
+
|
10
|
+
a:hover {
|
11
|
+
text-decoration: underline
|
12
|
+
}
|
13
|
+
|
14
|
+
* {
|
15
|
+
box-sizing: border-box;
|
16
|
+
margin: 0;
|
17
|
+
max-width: 100%;
|
18
|
+
padding: 0;
|
19
|
+
vertical-align: baseline;
|
20
|
+
font-family: system-ui, \"Helvetica Neue\", Helvetica, Arial, sans-serif;
|
21
|
+
font-size: 13px;
|
22
|
+
font-stretch: normal;
|
23
|
+
font-style: normal;
|
24
|
+
font-weight: 400;
|
25
|
+
line-height: 29.7px
|
26
|
+
}
|
27
|
+
|
28
|
+
body {
|
29
|
+
background: #fff;
|
30
|
+
color: #1a1919;
|
31
|
+
padding: 36px
|
32
|
+
}
|
33
|
+
</style>
|
34
|
+
<title>LL <%= Date.today %></title>
|
35
|
+
</head>
|
36
|
+
<body>
|
37
|
+
<p>Hi,</p>
|
38
|
+
<p>PFA the LL configuration at <%= DateTime.now %>.</p>
|
39
|
+
<p>Posted by
|
40
|
+
<a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
|
41
|
+
</p>
|
42
|
+
</body>
|
43
|
+
</html>
|
data/readme.md
CHANGED
@@ -19,6 +19,8 @@
|
|
19
19
|
[](http://www.rultor.com/p/dgroup/lazylead)
|
20
20
|
[](http://www.elegantobjects.org/#principles)
|
21
21
|
|
22
|
+
⚠️ We're still in a very early alpha version, the API may change frequently until we release version 1.0.
|
23
|
+
|
22
24
|
### Overview
|
23
25
|
Ticketing systems (Github, Jira, etc.) are strongly integrated into our processes and everyone understands their necessity. As soon as a developer becomes a lead/technical manager, he or she faces a set of routine tasks that are related to ticketing work. On large projects this becomes a problem, more and more you spend time running around on dashboards and tickets, looking for incorrect deviations in tickets and performing routine tasks instead of solving technical problems.
|
24
26
|
|
@@ -28,21 +30,21 @@ I think you remember how [static code analysis](https://en.wikipedia.org/wiki/St
|
|
28
30
|
|
29
31
|
Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
|
30
32
|
|
31
|
-
| Daily annoying task
|
32
|
-
|
|
33
|
-
| [Notify ticket's assignee](lib/lazylead/task/alert.rb)
|
34
|
-
| [Notify ticket's reporter](lib/lazylead/task/alert.rb)
|
35
|
-
| [Notify ticket's manager](lib/lazylead/task/alert.rb)
|
33
|
+
| Daily annoying task | Jira | Github | Trello |
|
34
|
+
| :---------------------------------------------------------------------------------- | :---: | :----: | :----: |
|
35
|
+
| [Notify ticket's assignee](lib/lazylead/task/alert.rb) | ✅ | ⌛ | ⌛ |
|
36
|
+
| [Notify ticket's reporter](lib/lazylead/task/alert.rb) | ✅ | ⌛ | ⌛ |
|
37
|
+
| [Notify ticket's manager](lib/lazylead/task/alert.rb) | ✅ | ⌛ | ⌛ |
|
36
38
|
| [Notify about illegal "Fix Version" modification](lib/lazylead/task/fix_version.rb) | ✅ | ❌ | ❌ |
|
37
|
-
| [Expected comment in ticket is missing](lib/lazylead/task/missing_comment.rb)
|
38
|
-
| Propagate some fields from parent ticket into sub-tasks
|
39
|
-
| Print the current capacity of team into newly created tasks
|
40
|
-
| Create/retrofit the defect automatically into latest release
|
41
|
-
| Notify about expired(ing) due dates
|
42
|
-
| Notify about absent original estimations
|
43
|
-
| Notify about 'Hot potato' tickets
|
44
|
-
| Notify about long live tickets (aging)
|
45
|
-
| Notify about tickets with invalid format (missing url/stacktrace, etc)
|
39
|
+
| [Expected comment in ticket is missing](lib/lazylead/task/missing_comment.rb) | ✅ | ⌛ | ⌛ |
|
40
|
+
| [Propagate some fields from parent ticket into sub-tasks](.docs/propagate_down.md) | ✅ | ❌ | ❌ |
|
41
|
+
| Print the current capacity of team into newly created tasks | ⌛ | ⌛ | ⌛ |
|
42
|
+
| Create/retrofit the defect automatically into latest release | ⌛ | ⌛ | ❌ |
|
43
|
+
| [Notify about expired(ing) due dates](.docs/duedate_expired.md) | ✅ | ❌ | ⌛ |
|
44
|
+
| Notify about absent original estimations | ⌛ | ⌛ | ⌛ |
|
45
|
+
| Notify about 'Hot potato' tickets | ⌛ | ⌛ | ⌛ |
|
46
|
+
| Notify about long live tickets (aging) | ⌛ | ⌛ | ⌛ |
|
47
|
+
| Notify about tickets with invalid format (missing url/stacktrace, etc) | ⌛ | ⌛ | ⌛ |
|
46
48
|
| Create a meeting(s) automatically in case some tickets appeared (group by assignee/reporters/component/ticket type/etc) | ⌛ | ⌛ | ⌛ |
|
47
49
|
|
48
50
|
| Integration | Type | Status |
|
@@ -59,7 +61,7 @@ Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
|
|
59
61
|
New ideas, bugs, suggestions or questions are welcome [via GitHub issues](https://github.com/dgroup/lazylead/issues/new)!
|
60
62
|
|
61
63
|
### Get started
|
62
|
-
|
64
|
+
⚠️ We're still in a very early alpha version, the API may change frequently until we release version 1.0.
|
63
65
|
|
64
66
|
Let's assume that:
|
65
67
|
- your team is using jira as a ticketing system
|
@@ -101,7 +103,7 @@ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
|
|
101
103
|
```
|
102
104
|
or just download the project using git
|
103
105
|
```bash
|
104
|
-
git clone https://github.com/dgroup/lazylead.git ll && cd ll
|
106
|
+
git clone https://github.com/dgroup/lazylead.git ll && cd ll
|
105
107
|
```
|
106
108
|
|
107
109
|
2. Create a container, using `docker-compose -f .github/tasks.yml up`
|
@@ -0,0 +1,133 @@
|
|
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 PlainCcTest < Lazylead::Test
|
33
|
+
test "cc has valid email" do
|
34
|
+
assert_equal "a@fake.com", Lazylead::PlainCC.new("a@fake.com").cc.first
|
35
|
+
end
|
36
|
+
|
37
|
+
test "cc has valid email despite on additional spaces" do
|
38
|
+
assert_equal "a@fake.com", Lazylead::PlainCC.new("a@fake.com ").cc.first
|
39
|
+
end
|
40
|
+
|
41
|
+
test "cc has valid email despite on unexpected symbols" do
|
42
|
+
assert_equal "a@f.com", Lazylead::PlainCC.new("a@f.com, , -").cc.first
|
43
|
+
end
|
44
|
+
|
45
|
+
test "cc has valid emails" do
|
46
|
+
assert_equal %w[a@fake.com b@fake.com c@fake.com],
|
47
|
+
Lazylead::PlainCC.new("a@fake.com,b@fake.com,c@fake.com").cc
|
48
|
+
end
|
49
|
+
|
50
|
+
test "cc count is correct" do
|
51
|
+
assert_equal 3, Lazylead::PlainCC.new("a@f.com,b@f.com,c@f.com").count
|
52
|
+
end
|
53
|
+
|
54
|
+
test "cc behaves as array" do
|
55
|
+
assert_equal %w[A@f.com B@f.com C@f.com],
|
56
|
+
Lazylead::PlainCC.new("a@f.com,b@f.com,c@f.com")
|
57
|
+
.map(&:capitalize)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class PredefinedCcTest < Lazylead::Test
|
62
|
+
test "predefined cc has valid emails" do
|
63
|
+
assert_entries(
|
64
|
+
{
|
65
|
+
"jdbc" => %w[j@fake.com],
|
66
|
+
"jvm" => %w[j@fake.com v@fake.com]
|
67
|
+
},
|
68
|
+
PredefinedCC.new(
|
69
|
+
"jdbc" => "j@fake.com ",
|
70
|
+
"jvm" => "j@fake.com,,v@fake.com"
|
71
|
+
).to_h
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
test "all predefined cc are valid emails" do
|
76
|
+
assert_equal %w[j@fake.com v@fake.com m@fake.com],
|
77
|
+
PredefinedCC.new(
|
78
|
+
"jdbc" => "j@fake.com ",
|
79
|
+
"jvm" => "j@fake.com,,v@fake.com,-, ,m@fake.com"
|
80
|
+
).cc
|
81
|
+
end
|
82
|
+
|
83
|
+
test "cc by key is found" do
|
84
|
+
assert_equal %w[j@fake.com],
|
85
|
+
PredefinedCC.new(
|
86
|
+
"jdbc" => "j@fake.com ",
|
87
|
+
"jvm" => "j@fake.com,,v@fake.com,-, ,m@fake.com"
|
88
|
+
)["jdbc"]
|
89
|
+
end
|
90
|
+
|
91
|
+
# @todo #/DEV The test has performance issue. Jira has no way how to take
|
92
|
+
# the emails for leads quickly due to https://bit.ly/2ZRZlWc.
|
93
|
+
# Thus, for each component we need to find a lead, and only then detect
|
94
|
+
# lead's email, thus, its took few minutes for huge projects.
|
95
|
+
test "cc by component is found" do
|
96
|
+
skip "Disabled due to performance issue with Jira API"
|
97
|
+
assert_equal ENV["cc_email"],
|
98
|
+
ComponentCC.new(
|
99
|
+
ENV["cc_project"],
|
100
|
+
Jira.new(
|
101
|
+
{
|
102
|
+
username: ENV["JIRA_USER"],
|
103
|
+
password: ENV["JIRA_PASS"],
|
104
|
+
site: ENV["JIRA_URL"],
|
105
|
+
context_path: ""
|
106
|
+
}
|
107
|
+
)
|
108
|
+
).cc(ENV["cc_component"])
|
109
|
+
end
|
110
|
+
|
111
|
+
test "detect plain cc" do
|
112
|
+
CLI::App.new(Log::NOTHING, NoSchedule.new).run(
|
113
|
+
home: ".",
|
114
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
115
|
+
vcs4sql: "upgrades/sqlite",
|
116
|
+
testdata: true
|
117
|
+
)
|
118
|
+
assert_equal %w[leelakenny@mail.com maciecrane@mail.com],
|
119
|
+
ORM::Task.find(3).detect_cc(nil)["cc"].cc
|
120
|
+
end
|
121
|
+
|
122
|
+
test "detect complex cc by predefined component" do
|
123
|
+
CLI::App.new(Log::NOTHING, NoSchedule.new).run(
|
124
|
+
home: ".",
|
125
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
126
|
+
vcs4sql: "upgrades/sqlite",
|
127
|
+
testdata: true
|
128
|
+
)
|
129
|
+
assert_equal %w[tom@fake.com mike@fake.com],
|
130
|
+
ORM::Task.find(165).detect_cc(nil)["cc"].cc("jvm", "jdbc")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -39,8 +39,7 @@ 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]
|
@@ -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
|
|
@@ -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::NOTHING,
|
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
@@ -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::NOTHING, 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,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::NOTHING,
|
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
|
@@ -118,5 +118,21 @@ module Lazylead
|
|
118
118
|
.filter { |m| m.subject.eql? "CC: Watching" }
|
119
119
|
.first.cc
|
120
120
|
end
|
121
|
+
|
122
|
+
test "reporter got alert about his/her tickets with expired due dates" do
|
123
|
+
Smtp.new.enable
|
124
|
+
Task::ReporterAlert.new.run(
|
125
|
+
NoAuthJira.new("https://jira.spring.io"),
|
126
|
+
Postman.new,
|
127
|
+
"from" => "fake@email.com",
|
128
|
+
"sql" => "filter=16743",
|
129
|
+
"subject" => "DD Expired!",
|
130
|
+
"template" => "lib/messages/due_date_expired.erb"
|
131
|
+
)
|
132
|
+
assert_equal 2,
|
133
|
+
Mail::TestMailer.deliveries
|
134
|
+
.filter { |m| m.subject.eql? "DD Expired!" }
|
135
|
+
.length
|
136
|
+
end
|
121
137
|
end
|
122
138
|
end
|
@@ -0,0 +1,86 @@
|
|
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/system/jira"
|
27
|
+
require_relative "../../../lib/lazylead/task/propagate_down"
|
28
|
+
|
29
|
+
module Lazylead
|
30
|
+
class PropagateDownTest < Lazylead::Test
|
31
|
+
test "propagate fields from parent ticket to sub-tasks" do
|
32
|
+
parent = OpenStruct.new(
|
33
|
+
id: 1,
|
34
|
+
key: "PRJ-1",
|
35
|
+
fields: {
|
36
|
+
subtasks: [{ id: 2 }.stringify_keys],
|
37
|
+
customfield_101: "Tomorrow",
|
38
|
+
customfield_102: "Yesterday"
|
39
|
+
}.stringify_keys
|
40
|
+
)
|
41
|
+
Child = Struct.new(:id, :key, :fields, :comment) do
|
42
|
+
def save(diff)
|
43
|
+
fields.merge! diff[:fields]
|
44
|
+
end
|
45
|
+
|
46
|
+
def comments
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
def build
|
51
|
+
self
|
52
|
+
end
|
53
|
+
|
54
|
+
def save!(body)
|
55
|
+
self[:comment] = body[:body]
|
56
|
+
end
|
57
|
+
end
|
58
|
+
child = Child.new(
|
59
|
+
2, "PRJ-2",
|
60
|
+
{
|
61
|
+
subtasks: [],
|
62
|
+
customfield_101: nil,
|
63
|
+
customfield_102: nil
|
64
|
+
}.stringify_keys
|
65
|
+
)
|
66
|
+
Task::PropagateDown.new.run(
|
67
|
+
Fake.new([parent, child]),
|
68
|
+
[],
|
69
|
+
"jql" => "type=Defect and updated>-1h and has subtasks without fields",
|
70
|
+
"fields" => "customfield_101,customfield_102"
|
71
|
+
)
|
72
|
+
assert_entries(
|
73
|
+
{
|
74
|
+
"customfield_101" => "Tomorrow",
|
75
|
+
"customfield_102" => "Yesterday"
|
76
|
+
},
|
77
|
+
child.fields
|
78
|
+
)
|
79
|
+
assert_words %w[The following fields were propagated from PRJ-1:
|
80
|
+
||Field||Value||
|
81
|
+
|customfield_101|Tomorrow|
|
82
|
+
|customfield_102|Yesterday|],
|
83
|
+
child.comment
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|