lazylead 0.8.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.docker/docker-compose.yml +1 -1
  3. data/.rubocop.yml +1 -0
  4. data/Rakefile +2 -3
  5. data/bin/lazylead +3 -0
  6. data/lazylead.gemspec +14 -14
  7. data/lib/lazylead/confluence.rb +1 -2
  8. data/lib/lazylead/log.rb +11 -0
  9. data/lib/lazylead/os.rb +55 -0
  10. data/lib/lazylead/system/jira.rb +10 -7
  11. data/lib/lazylead/task/accuracy/accuracy.rb +6 -7
  12. data/lib/lazylead/task/accuracy/attachment.rb +1 -0
  13. data/lib/lazylead/task/accuracy/logs_link.rb +52 -0
  14. data/lib/lazylead/task/accuracy/screenshots.rb +10 -6
  15. data/lib/lazylead/task/accuracy/testcase.rb +4 -4
  16. data/lib/lazylead/task/assignment.rb +9 -13
  17. data/lib/lazylead/task/fix_version.rb +5 -8
  18. data/lib/lazylead/task/loading.rb +6 -1
  19. data/lib/lazylead/task/micromanager.rb +111 -0
  20. data/lib/lazylead/task/svn/diff.rb +11 -11
  21. data/lib/lazylead/task/svn/grep.rb +8 -71
  22. data/lib/lazylead/task/svn/svn.rb +107 -0
  23. data/lib/lazylead/task/svn/touch.rb +5 -7
  24. data/lib/lazylead/version.rb +1 -1
  25. data/lib/messages/illegal_assignee_change.erb +1 -2
  26. data/lib/messages/illegal_duedate_change.erb +122 -0
  27. data/lib/messages/loading.erb +9 -8
  28. data/lib/messages/svn_diff.erb +29 -29
  29. data/lib/messages/svn_diff_attachment.erb +5 -7
  30. data/lib/messages/svn_grep.erb +34 -32
  31. data/readme.md +8 -5
  32. data/test/lazylead/system/jira_test.rb +8 -0
  33. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  34. data/test/lazylead/task/accuracy/logs_link_test.rb +50 -0
  35. data/test/lazylead/task/accuracy/onlyll_test.rb +1 -1
  36. data/test/lazylead/task/accuracy/screenshots_test.rb +16 -4
  37. data/test/lazylead/task/accuracy/testcase_test.rb +27 -0
  38. data/test/lazylead/task/alert/alertif_test.rb +2 -1
  39. data/test/lazylead/task/assignment_test.rb +2 -1
  40. data/test/lazylead/task/created_recently_test.rb +2 -1
  41. data/test/lazylead/task/duedate_test.rb +2 -2
  42. data/test/lazylead/task/fix_version_test.rb +2 -1
  43. data/test/lazylead/task/loading_test.rb +9 -4
  44. data/test/lazylead/task/micromanager_test.rb +61 -0
  45. data/test/lazylead/task/missing_comment_test.rb +1 -1
  46. data/test/lazylead/task/svn/diff_test.rb +1 -1
  47. data/test/lazylead/task/svn/grep_test.rb +2 -1
  48. data/test/test.rb +4 -3
  49. metadata +36 -27
@@ -102,8 +102,7 @@
102
102
  <tr>
103
103
  <td><a href='<%= a.issue.url %>'><%= a.issue.key %></a></td>
104
104
  <td><%= a.issue.priority %></td>
105
- <td><%= DateTime.parse(a.last["created"])
106
- .strftime('%d-%b-%Y %I:%M:%S %p') %></td>
105
+ <td><%= DateTime.parse(a.last["created"]).strftime('%d-%b') %></td>
107
106
  <td><span style='color: red'><%= a.last["author"]["displayName"] %></span>
108
107
  (<%= a.last["author"]["name"] %>)
109
108
  </td>
@@ -0,0 +1,122 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <style>
5
+ /* CSS styles taken from https://github.com/yegor256/tacit */
6
+ th {
7
+ font-weight: 600
8
+ }
9
+
10
+ table tr {
11
+ border-bottom-width: 2.16px
12
+ }
13
+
14
+ table tr th {
15
+ border-bottom-width: 2.16px
16
+ }
17
+
18
+ table tr td, table tr th {
19
+ overflow: hidden;
20
+ padding: 5.4px 3.6px
21
+ }
22
+
23
+ a {
24
+ color: #275a90;
25
+ text-decoration: none
26
+ }
27
+
28
+ a:hover {
29
+ text-decoration: underline
30
+ }
31
+
32
+ pre, code, kbd, samp, var, output {
33
+ font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
34
+ font-size: 13px
35
+ }
36
+
37
+ pre code {
38
+ background: none;
39
+ border: 0;
40
+ line-height: 29.7px;
41
+ padding: 0
42
+ }
43
+
44
+ code, kbd {
45
+ background: #daf1e0;
46
+ border-radius: 3.6px;
47
+ color: #2a6f3b;
48
+ display: inline-block;
49
+ line-height: 18px;
50
+ padding: 3.6px 6.3px 2.7px
51
+ }
52
+
53
+ * {
54
+ border: 0;
55
+ border-collapse: separate;
56
+ border-spacing: 0;
57
+ box-sizing: border-box;
58
+ margin: 0;
59
+ max-width: 100%;
60
+ padding: 0;
61
+ vertical-align: baseline;
62
+ font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
63
+ font-size: 13px;
64
+ font-stretch: normal;
65
+ font-style: normal;
66
+ font-weight: 400;
67
+ line-height: 29.7px
68
+ }
69
+
70
+ html, body {
71
+ width: 100%
72
+ }
73
+
74
+ html {
75
+ height: 100%
76
+ }
77
+
78
+ body {
79
+ background: #fff;
80
+ color: #1a1919;
81
+ padding: 36px
82
+ }
83
+ </style>
84
+ <title>Not authorized "Assignee" change</title>
85
+ </head>
86
+ <body>
87
+ <p>Hi,</p>
88
+
89
+ <p>The <span style='font-weight:bold'>'Duedate'</span> for the following
90
+ ticket(s) changed by not authorized person(s):</p>
91
+ <table summary="ticket(s) where duedate changed">
92
+ <tr>
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="to">To</th>
98
+ <th id="assignee">Assignee</th>
99
+ <th id="reporter">Reporter</th>
100
+ <th id="summary">Summary</th>
101
+ </tr>
102
+ <% dues.each do |d| %>
103
+ <tr>
104
+ <td><a href='<%= d.issue.url %>'><%= d.issue.key %></a></td>
105
+ <td><%= d.issue.priority %></td>
106
+ <td><%= d.when.to_date %></td>
107
+ <td><span style='color: red'><%= d.last.name %></span> (<%= d.last.id %>)</td>
108
+ <td><span style='color: red'><%= d.issue.duedate %></span></td>
109
+ <td><%= d.issue.assignee.name %></td>
110
+ <td><%= d.issue.reporter.name %></td>
111
+ <td><%= d.issue.summary %></td>
112
+ </tr>
113
+ <% end %>
114
+ </table>
115
+
116
+ <p>Authorized person(s) are: <code><%= allowed %></code>.</p>
117
+
118
+ <p>Posted by
119
+ <a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
120
+ </p>
121
+ </body>
122
+ </html>
@@ -69,12 +69,11 @@
69
69
  <body>
70
70
  <table summary="tickets">
71
71
  <tr>
72
- <th id="uid">ID</th>
73
72
  <th id="name">User</th>
74
73
  <th id="total">
75
- <a href="https://jira.spring.io/issues/?jql=<%= CGI.escape(jql) %>">Assigned From</a>
74
+ <a href="<%= search_link %><%= CGI.escape(jql) %>">Assigned From</a>
76
75
  </th>
77
- <th id="duedate">Next Due date</th>
76
+ <th id="duedate">Next due date</th>
78
77
  </tr>
79
78
  <% assignments.each do |teammate, assignment| %>
80
79
  <% if assignment.free? %>
@@ -83,17 +82,19 @@
83
82
  <tr>
84
83
  <% end %>
85
84
  <td>
86
- <div class="auto"><a href="<%= user_link %>"><%= teammate %></a></div>
87
- </td>
88
- <td>
89
- <div class="auto"><%= assignment.name %></div>
85
+ <div class="auto"><a href="<%= user_link %><%= teammate %>"><%= assignment.name %></a></div>
90
86
  </td>
91
87
  <td>
92
88
  <div class="auto">
93
89
  <% if assignment.free? %>
94
90
  <span style="color: red">0</span>
95
91
  <% else %>
96
- <a href="https://jira.spring.io/issues/?jql=<%= CGI.escape("#{jql} and assignee=#{teammate}") %>"><%= assignment.size %></a>
92
+ <% assignment.sprints(defined?(sprint) ? sprint : "customfield_10480").each do |s| %>
93
+ <a href="<%= search_link %><%= CGI.escape("#{jql} and assignee=#{teammate}") %>">
94
+ <%= s.first.blank? ? "No sprint" : s.first %>: <%= s.last.size %>
95
+ </a>
96
+ <br/>
97
+ <% end %>
97
98
  <% end %>
98
99
  </div>
99
100
  </td>
@@ -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><%= commit.time %></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 %>
@@ -64,14 +64,8 @@
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
+ td {
68
+ padding: 2px;
75
69
  }
76
70
 
77
71
  .commit * {
@@ -86,29 +80,37 @@
86
80
  <p>Hi,</p>
87
81
  <p>The following file(s) contain text <code><%= text %></code> in
88
82
  <a href="<%= svn_url %>"><%= svn_url %></a>:</p>
89
- <% entries.each do |commit| %>
90
- <div class="commit">
91
- <p style="background: gainsboro;">
92
- <a href="<%= commit_url %><%= commit.rev %>"><%= commit.msg %></a>
93
- by <a href="<%= user %><%= commit.author %>"><%= commit.author %></a>
94
- at <span style="color: #275a90;"><%= commit.time %></span>
95
- </p>
96
- <% commit.diff(text.split(",")).each do |line| %>
97
- <% if line.start_with?("+++") || line.start_with?("---") %>
98
- <p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
99
- <% elsif text.split(",").any? { |t| line.include? t } %>
100
- <p style="background: #F9F103;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
101
- <% elsif line.start_with?("+") %>
102
- <p style="<%= "background: darkseagreen;" %>"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
103
- <% elsif line.start_with?("-") %>
104
- <p style="<%= "background: lightsalmon;" %>"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
105
- <% else %>
106
- <p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
107
- <% end %>
108
- <% end %>
109
- </div>
110
- <% end %>
111
- <p>Posted by<a href="https://github.com/dgroup/lazylead">lazylead
112
- v<%= version %></a>.</p>
83
+ <table summary="table with svn commits">
84
+ <tr>
85
+ <th id="rev">rev</th>
86
+ <th id="when">when</th>
87
+ <th id="author">author</th>
88
+ <th id="commit_msg" style="text-align: left">commit</th>
89
+ </tr>
90
+ <% entries.each do |commit| %>
91
+ <tr>
92
+ <td><a href="<%= commit_url %><%= commit.rev %>"><%= commit.rev %></a></td>
93
+ <td><%= commit.time %></td>
94
+ <td><a href="<%= user %><%= commit.author %>"><%= commit.author %></a></td>
95
+ <td>
96
+ <b><p><%= commit.msg %></p></b>
97
+ <% commit.diff(text.split(",")).each do |line| %>
98
+ <% if line.start_with?("+++") || line.start_with?("---") %>
99
+ <p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
100
+ <% elsif text.split(",").any? { |t| line.include? t } %>
101
+ <p style="background: #F9F103;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
102
+ <% elsif line.start_with?("+") %>
103
+ <p style="<%= "background: darkseagreen;" %>"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
104
+ <% elsif line.start_with?("-") %>
105
+ <p style="<%= "background: lightsalmon;" %>"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
106
+ <% else %>
107
+ <p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
108
+ <% end %>
109
+ <% end %>
110
+ </td>
111
+ </tr>
112
+ <% end %>
113
+ </table>
114
+ <p>Posted by<a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.</p>
113
115
  </body>
114
116
  </html>
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,12 @@ 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
+
181
+ [Pull requests](http://www.elegantobjects.org/#principles) are welcome! Don't forget to add your name to contribution section and run this, beforehand:
179
182
  ```ruby
180
- bundle exec rake
183
+ rake -A
181
184
  ```
182
185
  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
186
 
@@ -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
@@ -0,0 +1,50 @@
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_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/task/accuracy/logs_link"
27
+
28
+ module Lazylead
29
+ class LogsLinkTest < Lazylead::Test
30
+ test "log file is present" do
31
+ assert LogsLink.new("https://mygraylog.com/log#5").passed(
32
+ OpenStruct.new(
33
+ attachments: [OpenStruct.new(attrs: { "size" => 10_241, "filename" => "catalina.log" })]
34
+ )
35
+ )
36
+ end
37
+
38
+ test "log file is absent but description has log reference" do
39
+ assert LogsLink.new("https://mygraylog.com").passed(
40
+ OpenStruct.new(description: "Here is the log for current ticket https://mygraylog.com/log#5")
41
+ )
42
+ end
43
+
44
+ test "log file is absent and link is absent" do
45
+ refute LogsLink.new("https://mygraylog.com").passed(
46
+ OpenStruct.new(attachments: [])
47
+ )
48
+ end
49
+ end
50
+ end