lazylead 0.8.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.docker/docker-compose.yml +1 -1
  3. data/.rubocop.yml +1 -0
  4. data/Rakefile +1 -1
  5. data/bin/lazylead +3 -0
  6. data/lazylead.gemspec +11 -11
  7. data/lib/lazylead/log.rb +11 -0
  8. data/lib/lazylead/os.rb +55 -0
  9. data/lib/lazylead/system/jira.rb +10 -7
  10. data/lib/lazylead/task/accuracy/accuracy.rb +14 -2
  11. data/lib/lazylead/task/accuracy/screenshots.rb +20 -7
  12. data/lib/lazylead/task/accuracy/testcase.rb +4 -4
  13. data/lib/lazylead/task/assignment.rb +9 -13
  14. data/lib/lazylead/task/fix_version.rb +5 -8
  15. data/lib/lazylead/task/loading.rb +6 -1
  16. data/lib/lazylead/task/micromanager.rb +111 -0
  17. data/lib/lazylead/task/svn/diff.rb +11 -11
  18. data/lib/lazylead/task/svn/grep.rb +8 -71
  19. data/lib/lazylead/task/svn/svn.rb +107 -0
  20. data/lib/lazylead/task/svn/touch.rb +5 -7
  21. data/lib/lazylead/version.rb +1 -1
  22. data/lib/messages/illegal_assignee_change.erb +1 -2
  23. data/lib/messages/illegal_duedate_change.erb +122 -0
  24. data/lib/messages/loading.erb +9 -8
  25. data/lib/messages/svn_diff.erb +29 -29
  26. data/lib/messages/svn_diff_attachment.erb +5 -7
  27. data/readme.md +9 -5
  28. data/test/lazylead/system/jira_test.rb +8 -0
  29. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  30. data/test/lazylead/task/accuracy/onlyll_test.rb +1 -1
  31. data/test/lazylead/task/accuracy/score_test.rb +11 -0
  32. data/test/lazylead/task/accuracy/screenshots_test.rb +61 -7
  33. data/test/lazylead/task/accuracy/testcase_test.rb +18 -0
  34. data/test/lazylead/task/alert/alertif_test.rb +2 -1
  35. data/test/lazylead/task/assignment_test.rb +2 -1
  36. data/test/lazylead/task/created_recently_test.rb +2 -1
  37. data/test/lazylead/task/duedate_test.rb +2 -2
  38. data/test/lazylead/task/fix_version_test.rb +2 -1
  39. data/test/lazylead/task/loading_test.rb +9 -4
  40. data/test/lazylead/task/micromanager_test.rb +61 -0
  41. data/test/lazylead/task/missing_comment_test.rb +1 -1
  42. data/test/lazylead/task/svn/diff_test.rb +1 -1
  43. data/test/lazylead/task/svn/grep_test.rb +2 -1
  44. data/test/test.rb +4 -3
  45. metadata +27 -21
@@ -64,20 +64,13 @@
64
64
  padding: 36px
65
65
  }
66
66
 
67
- .commit {
68
- min-width: 100%;
69
- border-radius: 3.5px;
70
- overflow: hidden;
71
- display: inline-block;
72
- line-height: 15px;
73
- font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
74
- border: 1px solid #BCC6CC;
67
+ th, td {
68
+ padding-left: 3px;
69
+ padding-right: 3px;
75
70
  }
76
71
 
77
- .commit * {
78
- padding-left: 4px;
79
- font-size: 8px;
80
- line-height: 12px;
72
+ th {
73
+ font-weight: bold;
81
74
  }
82
75
  </style>
83
76
  <title>SVN log</title>
@@ -86,23 +79,30 @@
86
79
  <p>Hi,</p>
87
80
  <p>The following file(s) changed since <code><%= since_rev %></code> rev in
88
81
  <a href="<%= svn_url %>"><%= svn_url %></a>:</p>
89
- <% stdout.split("------------------------------------------------------------------------").reject(&:blank?).reverse.each do |commit| %>
90
- <div class="commit">
91
- <% commit.split("\n").reject(&:blank?).each_with_index do |line, index| %>
92
- <p style="background: gainsboro;">
93
- <% if index.zero? %>
94
- <% details = line.split("|").map(&:strip).reject(&:blank?) %>
95
- <a href="<%= commit_url %><%= details[0][1..-1] %>"><%= details[0] %></a>
96
- by <a href="<%= user %><%= details[1] %>"><%= details[1] %></a>
97
- at <span style="color: #275a90;"><%= details[2] %></span>
98
- <% end %>
99
- <% if index == 1 %>
100
- <span style="padding-left: 4px"><%= line %></span>
101
- <% end %>
102
- </p>
103
- <% end %>
104
- </div>
105
- <% end %>
82
+ <table summary="diff">
83
+ <tr>
84
+ <th id="rev">rev</th>
85
+ <th id="author">Author</th>
86
+ <th id="time">When</th>
87
+ <th id="msg">Message</th>
88
+ </tr>
89
+ <% commits.each do |commit| %>
90
+ <tr>
91
+ <td>
92
+ <div class="auto">
93
+ <a href="<%= commit_url %><%= commit.rev %>"><%= commit.rev %></a>
94
+ </div>
95
+ </td>
96
+ <td>
97
+ <div class="auto">
98
+ <a href="<%= user %><%= commit.author %>"><%= commit.author %></a>
99
+ </div>
100
+ </td>
101
+ <td><%= DateTime.parse(commit.time).strftime("%d-%m-%Y %H:%M:%S") %></td>
102
+ <td><%= commit.lines[1] %></td>
103
+ </tr>
104
+ <% end %>
105
+ </table>
106
106
  <p>Posted by
107
107
  <a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
108
108
  </p>
@@ -91,18 +91,16 @@
91
91
  <p>Commit(s) since <code><%= since_rev %></code> revision in <a href="<%= svn_url %>"><%= svn_url %></a>:</p>
92
92
  <div id="table-of-contents" class="table-of-contents">
93
93
  <ul>
94
- <% stdout.split("------------------------------------------------------------------------").reject(&:blank?).reverse.each do |commit| %>
95
- <% details = commit.split("\n").reject(&:blank?).first.split("|").map(&:strip).reject(&:blank?) %>
96
- <li><a href="#<%= details[0] %>"><%= details[0] %></a> by <%= details[1] %> at <%= details[2] %></li>
94
+ <% commits.each do |commit| %>
95
+ <li><a href="#<%= commit.rev %>"><%= commit.rev %></a> by <%= commit.author %> at <%= commit.time %></li>
97
96
  <% end %>
98
97
  </ul>
99
98
  </div>
100
- <% stdout.split("------------------------------------------------------------------------").reject(&:blank?).reverse.each do |commit| %>
99
+ <% commits.each do |commit| %>
101
100
  <div class="commit">
102
- <% commit.split("\n").reject(&:blank?).each_with_index do |line, index| %>
101
+ <% commit.lines.each_with_index do |line, index| %>
103
102
  <% if index.zero? %>
104
- <% details = line.split("|").map(&:strip).reject(&:blank?) %>
105
- <p style="background: gainsboro;" id="<%= details[0] %>"><a href="<%= commit_url %><%= details[0][1..-1] %>"><%= details[0] %></a> by <a href="<%= user %><%= details[1] %>"><%= details[1] %></a> at <span style="color: #275a90;"><%= details[2] %></span>
103
+ <p style="background: gainsboro;" id="<%= commit.rev %>"><a href="<%= commit_url %><%= commit.rev %>"><%= commit.rev %></a> by <a href="<%= user %><%= commit.author %>"><%= commit.author %></a> at <span style="color: #275a90;"><%= commit.time %></span>
106
104
  <a href="#table-of-contents">&#8593;</a>
107
105
  </p>
108
106
  <% else %>
data/readme.md CHANGED
@@ -48,13 +48,15 @@ Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
48
48
  | Create a meeting(s) automatically in case some tickets appeared (group by assignee/reporters/component/ticket type/etc) | ⌛ | ⌛ | ⌛ | ❌ |
49
49
  | Propogate fields from parent tickets to sub-tasks | ✅ | ⌛ | ⌛ | ❌ |
50
50
  | Notify about tickets without comments with expected text | ✅ | ⌛ | ⌛ | ❌ |
51
- | Notify about team loading (no tasks on teammates) | ✅ | ⌛ | ⌛ | ❌ |
51
+ | [Notify about team loading (no tasks on teammates)](lib/lazylead/task/loading.rb) | ✅ | ⌛ | ⌛ | ❌ |
52
52
  | Notify about tickets matches predefined multiple conditions | ✅ | ⌛ | ⌛ | ❌ |
53
53
  | Link automatically the ticket and Confluence page if link found in ticket's comments/description | ✅ | ⌛ | ⌛ | ❌ |
54
54
  | Notify about tickets assigned to your team members not by effective managers| ✅ | ⌛ | ⌛ | ❌ |
55
55
  | Notify about modifications of important files in VCS | ❌ | ⌛ | ❌ | ✅ |
56
56
  | Notify about diff changes for past X period in VCS | ❌ | ⌛ | ❌ | ✅ |
57
57
  | Notify about changes with some text for past X period in VCS | ❌ | ⌛ | ❌ | ✅ |
58
+ | [Notify when someone outside of your team changed the due date on tickets for your team](lib/lazylead/task/micromanager.rb)| ✅ | ⌛ | ❌ | ❌ |
59
+ | [Notify when someone outside of your team assigned a ticket directly to the developer](lib/lazylead/task/assignment.rb)| ✅ | ⌛ | ❌ | ❌ |
58
60
 
59
61
  | Integration | Type | Status |
60
62
  | :---------------------------------------------------- | :-----------: | :----: |
@@ -65,7 +67,7 @@ Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
65
67
  | calendar.google.com | Calendar | ⌛ |
66
68
  | slack.com | Notifications | ⌛ |
67
69
 
68
- ✅ - implemented, ⌛ - planned, 🌵 - implemented, but not tested, ❌ - not supported by ticketing system.
70
+ ✅ - implemented, ⌛ - planned, 🌵 - implemented, but not tested, ❌ - not supported/planned.
69
71
 
70
72
  New ideas, bugs, suggestions or questions are welcome [via GitHub issues](https://github.com/dgroup/lazylead/issues/new)!
71
73
 
@@ -173,11 +175,13 @@ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
173
175
  ```
174
176
 
175
177
  ### How to contribute?
176
- [![EO badge](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org/#principles)
177
178
 
178
- Pull requests are welcome! Don't forget to add your name to contribution section and run this, beforehand:
179
+ <a href="https://www.buymeacoffee.com/lazylead" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
180
+ [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YLV7Z9UUM3AJL)
181
+
182
+ [Pull requests](http://www.elegantobjects.org/#principles) are welcome! Don't forget to add your name to contribution section and run this, beforehand:
179
183
  ```ruby
180
- bundle exec rake
184
+ rake -A
181
185
  ```
182
186
  Everyone interacting in this project’s codebases, issue trackers, chat rooms is expected to follow the [code of conduct](.github/CODE_OF_CONDUCT.md).
183
187
 
@@ -194,5 +194,13 @@ module Lazylead
194
194
  "context_path" => ""
195
195
  ).issues("key=DATAJDBC-480")
196
196
  end
197
+
198
+ test "sprint is found" do
199
+ assert_equal "Sprint 68",
200
+ NoAuthJira.new("https://jira.spring.io")
201
+ .issues("key=XD-3744", fields: ["customfield_10480"])
202
+ .first
203
+ .sprint("customfield_10480")
204
+ end
197
205
  end
198
206
  end
@@ -56,7 +56,7 @@ module Lazylead
56
56
  )
57
57
  )
58
58
  assert_email "[LL] Raised tickets",
59
- %w[DATAJDBC-493 0.5 100% MyeongHyeonLee Deadlock\ occurs]
59
+ "DATAJDBC-493", "0.5", "100%", "MyeongHyeonLee", "Deadlock occurs"
60
60
  end
61
61
 
62
62
  test "construct accuracy from orm" do
@@ -69,7 +69,7 @@ module Lazylead
69
69
  )
70
70
  )
71
71
  assert_email "[LL] Only",
72
- %w[XD-3725 Blocker EmbeddedHeadersMessageConverter]
72
+ "XD-3725", "Blocker", "EmbeddedHeadersMessageConverter"
73
73
  end
74
74
 
75
75
  test "detect score" do
@@ -23,6 +23,7 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/system/jira"
26
27
  require_relative "../../../../lib/lazylead/task/accuracy/accuracy"
27
28
  require_relative "../../../../lib/lazylead/task/accuracy/affected_build"
28
29
 
@@ -69,5 +70,15 @@ module Lazylead
69
70
  )
70
71
  ).evaluate.comment
71
72
  end
73
+
74
+ test "detect non-system reporter" do
75
+ assert_equal "grussell",
76
+ Score.new(
77
+ NoAuthJira.new("https://jira.spring.io")
78
+ .issues("key=INT-4116", expand: "changelog")
79
+ .first,
80
+ Opts.new("system-users" => "abilan")
81
+ ).reporter
82
+ end
72
83
  end
73
84
  end
@@ -51,13 +51,11 @@ module Lazylead
51
51
  )
52
52
  end
53
53
 
54
- test "issue has only one .png file however minimum 2 are required" do
54
+ test "issue has no .png file however minimum 1 are required" do
55
55
  refute Screenshots.new.passed(
56
56
  OpenStruct.new(
57
- description: "Hi,\n here are snapshots !img1.jpg|thumbnail!\n",
58
- fields: {
59
- "description" => "Hi,\n here are snapshots !img1.jpg|thumbnail!\n"
60
- },
57
+ description: "Hi,\n here are snapshots !img1.zip!\n",
58
+ fields: { "description" => "Hi,\n here are snapshots !img1.zip!\n" },
61
59
  attachments: [
62
60
  OpenStruct.new("filename" => "img1.jpg"),
63
61
  OpenStruct.new("filename" => "img2.jpg")
@@ -67,18 +65,74 @@ module Lazylead
67
65
  end
68
66
 
69
67
  test "issue has two .png files with reference in description but with extension mismatch" do
70
- refute Screenshots.new.passed(
68
+ refute Screenshots.new(minimum: 2).passed(
71
69
  OpenStruct.new(
72
70
  description: "Hi,\n here are snapshots !img1.jpg|thumbnail!\n!img2.jpg|thumbnail!\n",
71
+ fields: { "description" => "-" },
72
+ attachments: [
73
+ OpenStruct.new("filename" => "img1.JPG"),
74
+ OpenStruct.new("filename" => "img2.jpg")
75
+ ]
76
+ )
77
+ )
78
+ end
79
+
80
+ test "issue has two .png file in description but three .png in attachments" do
81
+ assert Screenshots.new.passed(
82
+ OpenStruct.new(
83
+ description: "Hi,\n here are snapshots !img1.JPG|thumbnail!\n!img2.jpg|thumbnail!\n",
73
84
  fields: {
74
- "description" => "Hi,\n here are snapshots !img1.jpg|thumbnail!\n!img2.jpg|thumbnail!\n"
85
+ "description" => "Hi,\n here are snapshots !img1.JPG|thumbnail!\n!img2.jpg|thumbnail!\n"
75
86
  },
76
87
  attachments: [
77
88
  OpenStruct.new("filename" => "img1.JPG"),
89
+ OpenStruct.new("filename" => "img2.jpg"),
90
+ OpenStruct.new("filename" => "img3.jpg")
91
+ ]
92
+ )
93
+ )
94
+ end
95
+
96
+ test "issue has two .png files with reference in description without thumbnail" do
97
+ assert Screenshots.new.passed(
98
+ OpenStruct.new(
99
+ description: "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n",
100
+ fields: { "description" => "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n" },
101
+ attachments: [
102
+ OpenStruct.new("filename" => "img1.jpg"),
78
103
  OpenStruct.new("filename" => "img2.jpg")
79
104
  ]
80
105
  )
81
106
  )
82
107
  end
108
+
109
+ test "issue has two .png files with reference in description but absent in attachments" do
110
+ refute Screenshots.new.passed(
111
+ OpenStruct.new(
112
+ description: "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n",
113
+ fields: {
114
+ "description" => "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n"
115
+ },
116
+ attachments: [
117
+ OpenStruct.new("filename" => "img3.jpg"),
118
+ OpenStruct.new("filename" => "img4.jpg")
119
+ ]
120
+ )
121
+ )
122
+ end
123
+
124
+ test "two screenshots with docx attach" do
125
+ assert Screenshots.new.passed(
126
+ OpenStruct.new(
127
+ description: "Hi,\n here are snapshots !img1.jpg!\n!img2.jpg!\n[example.docx^!https://jira.com/images/icons/link_attachment_5.gif|width=7,height=7! ^|https://jira.com/secure/attachment/23/23_example.docx]",
128
+ fields: { "description" => "-" },
129
+ attachments: [
130
+ OpenStruct.new("filename" => "img1.jpg"),
131
+ OpenStruct.new("filename" => "img2.jpg"),
132
+ OpenStruct.new("filename" => "example.docx")
133
+ ]
134
+ )
135
+ )
136
+ end
83
137
  end
84
138
  end
@@ -273,6 +273,24 @@ module Lazylead
273
273
  *{color:#DE10AA}[AR]{color}* = YYYY"
274
274
  end
275
275
 
276
+ test "TC named use case" do
277
+ assert testcase? "{color:#0747a6}+*Use case*+{color}
278
+ # Step 1
279
+ # Step ..
280
+ # Step N
281
+ *{color:#00673A}[ER]{color}* = XXXX
282
+ *{color:#DE10AA}[AR]{color}* = YYYY"
283
+ end
284
+
285
+ test "TC with full ar er words" do
286
+ assert testcase? "{color:#0747a6}+*Use case*+{color}
287
+ # Step 1
288
+ # Step ..
289
+ # Step N
290
+ *{color:#00673A}Expected result:{color}* = XXXX
291
+ *{color:#DE10AA}Actual Result:{color}* = YYYY"
292
+ end
293
+
276
294
  # ensure that issue description has a test case, AR and ER
277
295
  def testcase?(desc)
278
296
  Testcase.new.passed(OpenStruct.new(description: desc))
@@ -48,7 +48,8 @@ module Lazylead
48
48
  "template" => "lib/messages/alertif.erb"
49
49
  )
50
50
  )
51
- assert_email "[LL] alert if", %w[XD-3064 Critical Done Glenn Risberg HdfsMongoDB]
51
+ assert_email "[LL] alert if",
52
+ "XD-3064", "Critical", "Done", "Glenn Renfro", "Thomas Risberg", "HdfsMongoDB"
52
53
  end
53
54
  end
54
55
  end
@@ -47,7 +47,8 @@ module Lazylead
47
47
  )
48
48
  )
49
49
  assert_email "Assignment: How dare you?",
50
- %w[DATAJDBC-480 01-Apr-2020 Minor Mark\ Paluch tom,mike,bob EntityInstantiators]
50
+ "DATAJDBC-480", "01-Apr", "Minor", "Mark Paluch", "tom,mike,bob",
51
+ "EntityInstantiators"
51
52
  end
52
53
  end
53
54
  end
@@ -47,7 +47,8 @@ module Lazylead
47
47
  "template" => "lib/messages/created_recently.erb"
48
48
  )
49
49
  )
50
- assert_email "[CR] 20min ago!", %w[XD-3766 SGF-726]
50
+ assert_email "[CR] 20min ago!",
51
+ "XD-3766", "SGF-726"
51
52
  end
52
53
  end
53
54
  end
@@ -82,7 +82,7 @@ module Lazylead
82
82
  )
83
83
  )
84
84
  assert_email "[DD] HMCHT!",
85
- %w[STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
85
+ "STS-3599", "2013-11-08", "Major", "Miles Parker", "Use JavaFX WebView"
86
86
  end
87
87
 
88
88
  test "send notification about bunch of tickets" do
@@ -100,7 +100,7 @@ module Lazylead
100
100
  )
101
101
  )
102
102
  assert_email "ALRT: Frozen",
103
- %w[Hi Boss STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
103
+ "Hi Boss", "STS-3599", "2013-11-08", "Major", "Miles Parker", "Use JavaFX WebView"
104
104
  end
105
105
 
106
106
  test "cc got notification" do
@@ -48,7 +48,8 @@ module Lazylead
48
48
  )
49
49
  )
50
50
  assert_email "FixVersion: How dare you?",
51
- %w[DATAJDBC-480 01-Apr-2020 Minor Mark\ Paluch tom,mike,bob EntityInstantiators]
51
+ "DATAJDBC-480", "01-Apr-2020", "Minor", "Mark Paluch", "tom,mike,bob",
52
+ "EntityInstantiators"
52
53
  end
53
54
  end
54
55
  end
@@ -40,15 +40,20 @@ module Lazylead
40
40
  Opts.new(
41
41
  "to" => "lead@company.com",
42
42
  "from" => "ll@company.com",
43
- "jql" => "key=STS-3599",
44
- "team" => "mclaren:Tom McLaren,milesparker:Mi Pa",
43
+ "jql" => "key in (STS-3599, XD-3739, XD-3744)",
44
+ "team" => "mclaren:Tom McLaren,milesparker:Mi Pa,grussell:Gary Ru",
45
45
  "user_link" => "https://user.com?id=",
46
- "fields" => "description,assignee,component,priority,summary,duedate",
46
+ "search_link" => "https://jira.spring.io/issues/?jql=",
47
+ "fields" => "assignee,duedate,customfield_10480",
48
+ "sprint" => "customfield_10480",
47
49
  "subject" => "[LL] Team loading",
48
50
  "template" => "lib/messages/loading.erb"
49
51
  )
50
52
  )
51
- assert_email "[LL] Team loading", %w[mclaren Tom McLaren 0]
53
+ assert_email "[LL] Team loading",
54
+ "grussell", "Gary Ru", "Sprint 68", "1",
55
+ "Miles Parker", "No sprint: 1", "2013-11-08",
56
+ "Tom McLaren", "0"
52
57
  end
53
58
  end
54
59
  end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 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 "mail"
26
+
27
+ require_relative "../../test"
28
+ require_relative "../../../lib/lazylead/smtp"
29
+ require_relative "../../../lib/lazylead/opts"
30
+ require_relative "../../../lib/lazylead/postman"
31
+ require_relative "../../../lib/lazylead/task/micromanager"
32
+
33
+ module Lazylead
34
+ class MicromanagerTest < Lazylead::Test
35
+ test "alert in case duedate changed by not authorized person" do
36
+ Lazylead::Smtp.new.enable
37
+ Task::Micromanager.new.run(
38
+ NoAuthJira.new("https://jira.spring.io"),
39
+ Postman.new,
40
+ Opts.new(
41
+ "to" => "lead@company.com",
42
+ "from" => "ll@company.com",
43
+ "jql" => "key in ('STS-3599','SPR-6541') and duedate is not empty",
44
+ "fields" => "assignee,duedate,priority,created,summary,reporter",
45
+ "allowed" => "tom,mike,bob",
46
+ "period" => "86400",
47
+ "now" => "2009-12-10T00:04:00.000+0000",
48
+ "subject" => "DD: How dare you?",
49
+ "template" => "lib/messages/illegal_duedate_change.erb"
50
+ )
51
+ )
52
+ assert_email "DD: How dare you?",
53
+ "SPR-6541", "Major", "(kdonald)", "2009-12-10", "Spring's Maven Central", "tom,mike,bob"
54
+ end
55
+
56
+ test "since for past 1 min" do
57
+ greater_or_eq Task::Micromanager.new.since("period" => 60).to_i,
58
+ (Time.now - 60).to_i
59
+ end
60
+ end
61
+ end