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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.0pdd.yml +4 -1
  3. data/.circleci/config.yml +14 -4
  4. data/.docker/Dockerfile +5 -4
  5. data/.docker/vcs.dockerfile +10 -0
  6. data/.docs/accuracy.md +107 -0
  7. data/.docs/accuracy_email.jpg +0 -0
  8. data/.docs/accuracy_jira_comment.jpg +0 -0
  9. data/.docs/duedate_expired.md +92 -0
  10. data/.docs/propagate_down.md +89 -0
  11. data/.pdd +1 -1
  12. data/.rubocop.yml +7 -1
  13. data/.rultor.yml +2 -2
  14. data/.simplecov +0 -6
  15. data/bin/lazylead +13 -5
  16. data/lazylead.gemspec +4 -16
  17. data/lib/lazylead/cc.rb +180 -0
  18. data/lib/lazylead/cli/app.rb +4 -3
  19. data/lib/lazylead/exchange.rb +15 -2
  20. data/lib/lazylead/home.rb +38 -0
  21. data/lib/lazylead/log.rb +30 -8
  22. data/lib/lazylead/model.rb +60 -22
  23. data/lib/lazylead/opts.rb +68 -0
  24. data/lib/lazylead/postman.rb +15 -15
  25. data/lib/lazylead/schedule.rb +6 -4
  26. data/lib/lazylead/smtp.rb +1 -1
  27. data/lib/lazylead/system/fake.rb +1 -1
  28. data/lib/lazylead/system/jira.rb +51 -12
  29. data/lib/lazylead/system/synced.rb +2 -1
  30. data/lib/lazylead/task/accuracy/accuracy.rb +140 -0
  31. data/lib/lazylead/task/accuracy/affected_build.rb +43 -0
  32. data/lib/lazylead/task/accuracy/requirement.rb +40 -0
  33. data/lib/lazylead/task/alert.rb +8 -6
  34. data/lib/lazylead/task/confluence_ref.rb +4 -3
  35. data/lib/lazylead/task/echo.rb +4 -0
  36. data/lib/lazylead/task/fix_version.rb +10 -6
  37. data/lib/lazylead/task/missing_comment.rb +7 -5
  38. data/lib/lazylead/task/propagate_down.rb +126 -0
  39. data/lib/lazylead/task/savepoint.rb +58 -0
  40. data/lib/lazylead/task/touch.rb +102 -0
  41. data/lib/lazylead/version.rb +1 -1
  42. data/lib/messages/accuracy.erb +118 -0
  43. data/lib/messages/due_date_expired.erb +8 -7
  44. data/lib/messages/illegal_fixversion_change.erb +9 -8
  45. data/lib/messages/missing_comment.erb +10 -9
  46. data/lib/messages/savepoint.erb +43 -0
  47. data/lib/messages/svn_touch.erb +147 -0
  48. data/readme.md +35 -32
  49. data/test/lazylead/cc_test.rb +153 -0
  50. data/test/lazylead/cli/app_test.rb +3 -4
  51. data/test/lazylead/exchange_test.rb +22 -2
  52. data/test/lazylead/model_test.rb +14 -3
  53. data/test/lazylead/opts_test.rb +70 -0
  54. data/test/lazylead/postman_test.rb +57 -0
  55. data/test/lazylead/smtp_test.rb +1 -1
  56. data/test/lazylead/system/jira_test.rb +35 -1
  57. data/test/lazylead/task/accuracy/accuracy_test.rb +73 -0
  58. data/test/lazylead/task/accuracy/affected_build_test.rb +42 -0
  59. data/test/lazylead/task/assignee_alert_test.rb +2 -2
  60. data/test/lazylead/task/duedate_test.rb +48 -22
  61. data/test/lazylead/task/fix_version_test.rb +9 -6
  62. data/test/lazylead/task/missing_comment_test.rb +11 -9
  63. data/test/lazylead/task/propagate_down_test.rb +88 -0
  64. data/test/lazylead/task/savepoint_test.rb +51 -0
  65. data/test/lazylead/task/touch_test.rb +63 -0
  66. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +0 -1
  67. data/upgrades/sqlite/999.testdata.sql +5 -1
  68. metadata +41 -176
  69. data/todo.yml +0 -6
@@ -0,0 +1,73 @@
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/smtp"
27
+ require_relative "../../../../lib/lazylead/task/accuracy/accuracy"
28
+ require_relative "../../../../lib/lazylead/opts"
29
+ require_relative "../../../../lib/lazylead/postman"
30
+ require_relative "../../../../lib/lazylead/cli/app"
31
+ require_relative "../../../../lib/lazylead/system/jira"
32
+
33
+ module Lazylead
34
+ class AccuracyTest < Lazylead::Test
35
+ test "detect affected build" do
36
+ Lazylead::Smtp.new.enable
37
+ Task::Accuracy.new.run(
38
+ NoAuthJira.new("https://jira.spring.io"),
39
+ Postman.new,
40
+ Opts.new(
41
+ "from" => "ll@fake.com",
42
+ "to" => "lead@fake.com",
43
+ "rules" => "Lazylead::RequirementAffectedBuild",
44
+ "silent" => "true",
45
+ "colors" => {
46
+ "0" => "#FF4F33",
47
+ "35" => "#FF9F33",
48
+ "57" => "#19DD1E",
49
+ "90" => "#0FA81A"
50
+ }.to_json.to_s,
51
+ "docs" => "https://github.com/dgroup/lazylead/blob/master/.github/ISSUE_TEMPLATE/bug_report.md",
52
+ "jql" => "key in (DATAJDBC-490, DATAJDBC-492, DATAJDBC-493)",
53
+ "max_results" => 200,
54
+ "subject" => "[LL] Raised tickets",
55
+ "template" => "lib/messages/accuracy.erb"
56
+ )
57
+ )
58
+ assert_email "[LL] Raised tickets",
59
+ %w[DATAJDBC-493 0.5 100% MyeongHyeonLee Deadlock\ occurs]
60
+ end
61
+
62
+ test "construct accuracy from orm" do
63
+ CLI::App.new(Log.new, NoSchedule.new).run(
64
+ home: ".",
65
+ sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
66
+ vcs4sql: "upgrades/sqlite",
67
+ testdata: true
68
+ )
69
+ assert_kind_of Lazylead::Task::Accuracy,
70
+ ORM::Task.find(195).action.constantize.new
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,42 @@
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/task/accuracy/affected_build"
27
+
28
+ module Lazylead
29
+ class AffectedBuildTest < Lazylead::Test
30
+ test "affected version absent" do
31
+ refute RequirementAffectedBuild.new.passed(
32
+ OpenStruct.new(fields: { "versions" => [] })
33
+ )
34
+ end
35
+
36
+ test "affected version provided" do
37
+ assert RequirementAffectedBuild.new.passed(
38
+ OpenStruct.new(fields: { "versions" => ["0.4.0"] })
39
+ )
40
+ end
41
+ end
42
+ end
@@ -34,8 +34,8 @@ require_relative "../../../lib/lazylead/task/alert"
34
34
 
35
35
  module Lazylead
36
36
  class AssigneeAlertTest < Lazylead::Test
37
- test "issue #154: undefined method to_hash for nil object" do
38
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
37
+ test "issue #154 undefined method to_hash for nil object" do
38
+ CLI::App.new(Log.new, NoSchedule.new).run(
39
39
  home: ".",
40
40
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
41
41
  vcs4sql: "upgrades/sqlite",
@@ -41,10 +41,12 @@ module Lazylead
41
41
  Task::AssigneeAlert.new.run(
42
42
  NoAuthJira.new("https://jira.spring.io"),
43
43
  Postman.new,
44
- "from" => "fake@email.com",
45
- "sql" => "filter=16743",
46
- "subject" => "[DD] PDTN!",
47
- "template" => "lib/messages/due_date_expired.erb"
44
+ Opts.new(
45
+ "from" => "fake@email.com",
46
+ "sql" => "filter=16743",
47
+ "subject" => "[DD] PDTN!",
48
+ "template" => "lib/messages/due_date_expired.erb"
49
+ )
48
50
  )
49
51
  assert_equal 2,
50
52
  Mail::TestMailer.deliveries
@@ -53,7 +55,7 @@ module Lazylead
53
55
  end
54
56
 
55
57
  test "configuration properties merged successfully" do
56
- CLI::App.new(Log::NOTHING, NoSchedule.new).run(
58
+ CLI::App.new(Log.new, NoSchedule.new).run(
57
59
  home: ".",
58
60
  sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
59
61
  vcs4sql: "upgrades/sqlite",
@@ -75,10 +77,12 @@ module Lazylead
75
77
  Task::AssigneeAlert.new.run(
76
78
  NoAuthJira.new("https://jira.spring.io"),
77
79
  Postman.new,
78
- "from" => "fake@email.com",
79
- "sql" => "key in ('STS-3599')",
80
- "subject" => "[DD] HMCHT!",
81
- "template" => "lib/messages/due_date_expired.erb"
80
+ Opts.new(
81
+ "from" => "fake@email.com",
82
+ "sql" => "key in ('STS-3599')",
83
+ "subject" => "[DD] HMCHT!",
84
+ "template" => "lib/messages/due_date_expired.erb"
85
+ )
82
86
  )
83
87
  assert_email "[DD] HMCHT!",
84
88
  %w[STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
@@ -89,12 +93,14 @@ module Lazylead
89
93
  Task::Alert.new.run(
90
94
  NoAuthJira.new("https://jira.spring.io"),
91
95
  Postman.new,
92
- "from" => "fake@email.com",
93
- "sql" => "key in ('STS-3599')",
94
- "subject" => "ALRT: Frozen",
95
- "template" => "lib/messages/due_date_expired.erb",
96
- "to" => "big.boss@example.com",
97
- "addressee" => "Boss"
96
+ Opts.new(
97
+ "from" => "fake@email.com",
98
+ "sql" => "key in ('STS-3599')",
99
+ "subject" => "ALRT: Frozen",
100
+ "template" => "lib/messages/due_date_expired.erb",
101
+ "to" => "big.boss@example.com",
102
+ "addressee" => "Boss"
103
+ )
98
104
  )
99
105
  assert_email "ALRT: Frozen",
100
106
  %w[Hi Boss STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
@@ -105,18 +111,38 @@ module Lazylead
105
111
  Task::Alert.new.run(
106
112
  NoAuthJira.new("https://jira.spring.io"),
107
113
  Postman.new,
108
- "from" => "fake@email.com",
109
- "sql" => "key in ('STS-3599')",
110
- "subject" => "CC: Watching",
111
- "template" => "lib/messages/due_date_expired.erb",
112
- "to" => "big.boss@example.com",
113
- "addressee" => "Boss",
114
- "cc" => "another.boss@example.com,mom@home.com"
114
+ Opts.new(
115
+ "from" => "fake@email.com",
116
+ "sql" => "key in ('STS-3599')",
117
+ "subject" => "CC: Watching",
118
+ "template" => "lib/messages/due_date_expired.erb",
119
+ "to" => "big.boss@example.com",
120
+ "addressee" => "Boss",
121
+ "cc" => "another.boss@example.com,mom@home.com"
122
+ )
115
123
  )
116
124
  assert_equal %w[another.boss@example.com mom@home.com],
117
125
  Mail::TestMailer.deliveries
118
126
  .filter { |m| m.subject.eql? "CC: Watching" }
119
127
  .first.cc
120
128
  end
129
+
130
+ test "reporter got alert about his/her tickets with expired DD" do
131
+ Smtp.new.enable
132
+ Task::ReporterAlert.new.run(
133
+ NoAuthJira.new("https://jira.spring.io"),
134
+ Postman.new,
135
+ Opts.new(
136
+ "from" => "fake@email.com",
137
+ "sql" => "filter=16743",
138
+ "subject" => "DD Expired!",
139
+ "template" => "lib/messages/due_date_expired.erb"
140
+ )
141
+ )
142
+ assert_equal 2,
143
+ Mail::TestMailer.deliveries
144
+ .filter { |m| m.subject.eql? "DD Expired!" }
145
+ .length
146
+ end
121
147
  end
122
148
  end
@@ -26,6 +26,7 @@ require "mail"
26
26
 
27
27
  require_relative "../../test"
28
28
  require_relative "../../../lib/lazylead/smtp"
29
+ require_relative "../../../lib/lazylead/opts"
29
30
  require_relative "../../../lib/lazylead/postman"
30
31
  require_relative "../../../lib/lazylead/task/fix_version"
31
32
 
@@ -36,12 +37,14 @@ module Lazylead
36
37
  Task::FixVersion.new.run(
37
38
  NoAuthJira.new("https://jira.spring.io"),
38
39
  Postman.new,
39
- "to" => "lead@company.com",
40
- "from" => "ll@company.com",
41
- "jql" => "key in ('DATAJDBC-480') and fixVersion is not empty",
42
- "allowed" => "tom,mike,bob",
43
- "subject" => "FixVersion: How dare you?",
44
- "template" => "lib/messages/illegal_fixversion_change.erb"
40
+ Opts.new(
41
+ "to" => "lead@company.com",
42
+ "from" => "ll@company.com",
43
+ "jql" => "key in ('DATAJDBC-480') and fixVersion is not empty",
44
+ "allowed" => "tom,mike,bob",
45
+ "subject" => "FixVersion: How dare you?",
46
+ "template" => "lib/messages/illegal_fixversion_change.erb"
47
+ )
45
48
  )
46
49
  assert_email "FixVersion: How dare you?",
47
50
  %w[DATAJDBC-480 01-Apr-2020 Minor Mark\ Paluch tom,mike,bob EntityInstantiators]
@@ -37,15 +37,17 @@ module Lazylead
37
37
  Task::MissingComment.new.run(
38
38
  NoAuthJira.new("https://jira.spring.io"),
39
39
  Postman.new,
40
- "to" => "lead@company.com",
41
- "addressee" => "Tom",
42
- "from" => "ll@company.com",
43
- "jql" => "key=DATAJDBC-523",
44
- "text" => "ftp.com/demo.avi",
45
- "details" => "reference to <code>ftp.com/demo.avi</code>",
46
- "subject" => "Expected ftp link is missing",
47
- "template" => "lib/messages/missing_comment.erb",
48
- "template_details" => "reference to <a href='file://ftp/path'>ftp</a>"
40
+ Opts.new(
41
+ "to" => "lead@company.com",
42
+ "addressee" => "Tom",
43
+ "from" => "ll@company.com",
44
+ "jql" => "key=DATAJDBC-523",
45
+ "text" => "ftp.com/demo.avi",
46
+ "details" => "reference to <code>ftp.com/demo.avi</code>",
47
+ "subject" => "Expected ftp link is missing",
48
+ "template" => "lib/messages/missing_comment.erb",
49
+ "template_details" => "reference to <a href='file://ftp/path'>ftp</a>"
50
+ )
49
51
  )
50
52
  assert_email "Expected ftp link is missing",
51
53
  %w[DATAJDBC-523 Major Mark\ Paluch https://github.com/spring-projects/spring-data-jdbc/commit/aadbb667ed1d61139d5ac51a06eb3dd1b39316db#diff-510a5041bb8a0575e97fedf105606b83R130]
@@ -0,0 +1,88 @@
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
+ Opts.new(
70
+ "jql" => "type=Defect and updated>-1h and subtasks without fields",
71
+ "propagate" => "customfield_101,customfield_102"
72
+ )
73
+ )
74
+ assert_entries(
75
+ {
76
+ "customfield_101" => "Tomorrow",
77
+ "customfield_102" => "Yesterday"
78
+ },
79
+ child.fields
80
+ )
81
+ assert_words %w[The following fields were propagated from PRJ-1:
82
+ ||Field||Value||
83
+ |customfield_101|Tomorrow|
84
+ |customfield_102|Yesterday|],
85
+ child.comment
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,51 @@
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/smtp"
27
+ require_relative "../../../lib/lazylead/postman"
28
+ require_relative "../../../lib/lazylead/task/savepoint"
29
+
30
+ module Lazylead
31
+ class SavepointTest < Lazylead::Test
32
+ test "send lazylead config as a mail attachment" do
33
+ Smtp.new.enable
34
+ ARGV[2] = "--sqlite"
35
+ ARGV[3] = "readme.md"
36
+ Task::Savepoint.new.run(
37
+ [],
38
+ Postman.new,
39
+ "from" => "fake@email.com",
40
+ "subject" => "[LL] Configuration backup",
41
+ "template" => "lib/messages/savepoint.erb",
42
+ "to" => "big.boss@example.com"
43
+ )
44
+ assert_equal 'text/markdown; filename="readme.md"',
45
+ Mail::TestMailer.deliveries
46
+ .filter { |m| m.subject.eql? "[LL] Configuration backup" }
47
+ .first.attachments.first.header.fields[0]
48
+ .unparsed_value
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,63 @@
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 "mail"
26
+ require_relative "../../test"
27
+ require_relative "../../../lib/lazylead/smtp"
28
+
29
+ require_relative "../../../lib/lazylead/postman"
30
+ require_relative "../../../lib/lazylead/task/touch"
31
+
32
+ module Lazylead
33
+ class SvnTouchTest < Lazylead::Test
34
+ # @todo #/DEV Find stable svn repo which can be used for stable test, for
35
+ # now only floating repo used for testing locally. Also, create a new
36
+ # method "ping" which can be used during tests like
37
+ # skip "No connection available to svn repo" unless ping("https://svn.com")
38
+ test "important files changed in svn repo" do
39
+ skip "No svn credentials provided" unless env? "svn_url",
40
+ "svn_user",
41
+ "svn_password"
42
+ Lazylead::Smtp.new.enable
43
+ Task::SvnTouch.new.run(
44
+ nil,
45
+ Postman.new,
46
+ "svn_url" => ENV["svn_url"],
47
+ "svn_user" => ENV["svn_user"],
48
+ "svn_password" => ENV["svn_password"],
49
+ "commit_url" => "https://view.commit.com?rev=",
50
+ "user" => "https://user.com?id=",
51
+ "to" => "lead@fake.com",
52
+ "from" => "ll@fake.com",
53
+ "now" => "2020-07-12T17:24:45+01:00",
54
+ "period" => "864000",
55
+ "files" => "checkstyle.xml,checkstyle_suppressions.xml",
56
+ "subject" => "[SVN] Static analysis configuration has been changed!",
57
+ "template" => "lib/messages/svn_touch.erb"
58
+ )
59
+ assert_email "[SVN] Static analysis configuration has been changed!",
60
+ %w[revision user ticket]
61
+ end
62
+ end
63
+ end