lazylead 0.1.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 +7 -0
- data/ .dockerignore +12 -0
- data/.0pdd.yml +5 -0
- data/.circleci/config.yml +50 -0
- data/.circleci/release_image.sh +13 -0
- data/.circleci/validate.sh +10 -0
- data/.docker/Dockerfile +31 -0
- data/.docker/build.sh +6 -0
- data/.docker/docker-compose.yml +23 -0
- data/.docker/readme.md +21 -0
- data/.gitattributes +9 -0
- data/.github/CODE_OF_CONDUCT.md +76 -0
- data/.github/CONTRIBUTING.md +9 -0
- data/.github/ISSUE_TEMPLATE.md +14 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- data/.github/tasks.yml +24 -0
- data/.github/trello.md +18 -0
- data/.gitignore +12 -0
- data/.pdd +5 -0
- data/.rubocop.yml +87 -0
- data/.ruby-version +1 -0
- data/.rultor.yml +31 -0
- data/.simplecov +16 -0
- data/.travis.yml +16 -0
- data/Gemfile +27 -0
- data/Guardfile +33 -0
- data/Rakefile +93 -0
- data/appveyor.yml +50 -0
- data/bin/.ruby-version +1 -0
- data/bin/lazylead +99 -0
- data/build.sh +6 -0
- data/deploy.sh +16 -0
- data/lazylead.gemspec +106 -0
- data/lib/lazylead.rb +52 -0
- data/lib/lazylead/allocated.rb +56 -0
- data/lib/lazylead/cli/app.rb +87 -0
- data/lib/lazylead/confluence.rb +157 -0
- data/lib/lazylead/email.rb +74 -0
- data/lib/lazylead/exchange.rb +83 -0
- data/lib/lazylead/log.rb +71 -0
- data/lib/lazylead/model.rb +140 -0
- data/lib/lazylead/postman.rb +78 -0
- data/lib/lazylead/salt.rb +91 -0
- data/lib/lazylead/schedule.rb +88 -0
- data/lib/lazylead/smtp.rb +82 -0
- data/lib/lazylead/system/empty.rb +36 -0
- data/lib/lazylead/system/fake.rb +41 -0
- data/lib/lazylead/system/jira.rb +249 -0
- data/lib/lazylead/system/synced.rb +41 -0
- data/lib/lazylead/task/alert.rb +105 -0
- data/lib/lazylead/task/confluence_ref.rb +59 -0
- data/lib/lazylead/task/echo.rb +38 -0
- data/lib/lazylead/task/fix_version.rb +79 -0
- data/lib/lazylead/task/missing_comment.rb +53 -0
- data/lib/lazylead/version.rb +27 -0
- data/lib/messages/due_date_expired.erb +96 -0
- data/lib/messages/illegal_fixversion_change.erb +120 -0
- data/lib/messages/missing_comment.erb +128 -0
- data/license.txt +21 -0
- data/readme.md +160 -0
- data/test/lazylead/allocated_test.rb +51 -0
- data/test/lazylead/cli/app_test.rb +74 -0
- data/test/lazylead/confluence_test.rb +55 -0
- data/test/lazylead/exchange_test.rb +68 -0
- data/test/lazylead/model_test.rb +65 -0
- data/test/lazylead/salt_test.rb +42 -0
- data/test/lazylead/smoke_test.rb +38 -0
- data/test/lazylead/smtp_test.rb +65 -0
- data/test/lazylead/system/jira_test.rb +110 -0
- data/test/lazylead/task/confluence_ref_test.rb +66 -0
- data/test/lazylead/task/duedate_test.rb +126 -0
- data/test/lazylead/task/echo_test.rb +34 -0
- data/test/lazylead/task/fix_version_test.rb +52 -0
- data/test/lazylead/task/missing_comment_test.rb +56 -0
- data/test/lazylead/version_test.rb +36 -0
- data/test/sqlite_test.rb +80 -0
- data/test/test.rb +103 -0
- data/todo.yml +16 -0
- data/upgrades/sqlite/001-install-main-lazylead-tables.sql +63 -0
- data/upgrades/sqlite/999.testdata.sql +39 -0
- metadata +815 -0
@@ -0,0 +1,74 @@
|
|
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 "../../sqlite_test"
|
26
|
+
require_relative "../../../lib/lazylead/log"
|
27
|
+
require_relative "../../../lib/lazylead/cli/app"
|
28
|
+
require_relative "../../../lib/lazylead/model"
|
29
|
+
|
30
|
+
module Lazylead
|
31
|
+
module CLI
|
32
|
+
class AppTest < Lazylead::SqliteTest
|
33
|
+
test "LL database structure installed successfully" do
|
34
|
+
CLI::App.new(Log::NOTHING, NoSchedule.new).run(
|
35
|
+
home: ".",
|
36
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
37
|
+
vcs4sql: "upgrades/sqlite"
|
38
|
+
)
|
39
|
+
assert_tables "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
40
|
+
systems: %w[id properties],
|
41
|
+
teams: %w[id name properties],
|
42
|
+
tasks: %w[id name cron system action team_id description
|
43
|
+
enabled properties]
|
44
|
+
assert_fk "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
45
|
+
%w[tasks team_id teams id],
|
46
|
+
%w[tasks system systems id]
|
47
|
+
end
|
48
|
+
|
49
|
+
test "activesupport is activated for access to domain entities" do
|
50
|
+
CLI::App.new(Log::NOTHING, Schedule.new(Log::NOTHING, false)).run(
|
51
|
+
home: ".",
|
52
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
53
|
+
vcs4sql: "upgrades/sqlite",
|
54
|
+
testdata: true
|
55
|
+
)
|
56
|
+
assert_equal "BA squad",
|
57
|
+
ORM::Team.find(1).name,
|
58
|
+
"Required team record wasn't found in the database"
|
59
|
+
end
|
60
|
+
|
61
|
+
# @todo #10/DEV Think about using "timecop" >v0.9.1 gem in order to make
|
62
|
+
# E2E application skeleton https://stackoverflow.com/questions/59955571.
|
63
|
+
# The depedency for gemspec should be after *thin* in .gemspec
|
64
|
+
# ..
|
65
|
+
# s.add_runtime_dependency "thin", "1.7.2"
|
66
|
+
# s.add_runtime_dependency "timecop", "0.9.1"
|
67
|
+
# ..
|
68
|
+
# More https://github.com/travisjeffery/timecop
|
69
|
+
test "scheduled task was triggered successfully" do
|
70
|
+
skip "Not implemented yet"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,55 @@
|
|
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/confluence"
|
27
|
+
|
28
|
+
module Lazylead
|
29
|
+
class ConfluenceTest < Lazylead::Test
|
30
|
+
test "make link from jira to confluence" do
|
31
|
+
assert_entries(
|
32
|
+
{
|
33
|
+
globalId: "appId=dddd&pageId=0000",
|
34
|
+
application: {
|
35
|
+
type: "com.atlassian.confluence",
|
36
|
+
name: "Knowledge System"
|
37
|
+
},
|
38
|
+
relationship: "Wiki Page",
|
39
|
+
object: {
|
40
|
+
url: "https://conf.com/pages/viewpage.action?pageId=0000",
|
41
|
+
title: "Wiki Page"
|
42
|
+
}
|
43
|
+
},
|
44
|
+
Confluence.new(
|
45
|
+
OpenStruct.new(
|
46
|
+
app: "dddd",
|
47
|
+
url: "https://conf.com",
|
48
|
+
name: "Knowledge System",
|
49
|
+
type: "com.atlassian.confluence"
|
50
|
+
)
|
51
|
+
).make_link("https://conf.com/pages/viewpage.action?pageId=0000")
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,68 @@
|
|
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/exchange"
|
29
|
+
require_relative "../../lib/lazylead/system/jira"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
class ExchangeTest < Lazylead::Test
|
33
|
+
test "email notification to outlook exchange" do
|
34
|
+
skip "No MS Exchange credentials provided" unless env? "exchange_url",
|
35
|
+
"exchange_user",
|
36
|
+
"exchange_password",
|
37
|
+
"exchange_to"
|
38
|
+
Exchange.new(Log::NOTHING, NoSalt.new).send(
|
39
|
+
to: ENV["exchange_to"],
|
40
|
+
tickets: NoAuthJira.new("https://jira.spring.io")
|
41
|
+
.issues("key = DATAJDBC-480"),
|
42
|
+
"subject" => "[DD] PDTN!",
|
43
|
+
"template" => "lib/messages/due_date_expired.erb"
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
test "exchange email notification using decrypted credentials" do
|
48
|
+
skip "No cryptography salt provided" unless env? "exchange_salt"
|
49
|
+
skip "No MS Exchange credentials provided" unless env? "exchange_url",
|
50
|
+
"enc_exchange_usr",
|
51
|
+
"enc_exchange_psw",
|
52
|
+
"enc_exchange_to"
|
53
|
+
Exchange.new(
|
54
|
+
Log::NOTHING,
|
55
|
+
Salt.new("exchange_salt"),
|
56
|
+
"exchange_url" => ENV["exchange_url"],
|
57
|
+
"exchange_user" => ENV["enc_exchange_usr"],
|
58
|
+
"exchange_password" => ENV["enc_exchange_psw"]
|
59
|
+
).send(
|
60
|
+
to: ENV["exchange_to"],
|
61
|
+
tickets: NoAuthJira.new("https://jira.spring.io")
|
62
|
+
.issues("key = DATAJDBC-480"),
|
63
|
+
"subject" => "[DD] Enc PDTN!",
|
64
|
+
"template" => "lib/messages/due_date_expired.erb"
|
65
|
+
)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,65 @@
|
|
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 "../sqlite_test"
|
26
|
+
require_relative "../../lib/lazylead/log"
|
27
|
+
require_relative "../../lib/lazylead/model"
|
28
|
+
require_relative "../../lib/lazylead/cli/app"
|
29
|
+
require_relative "../../lib/lazylead/schedule"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
class OrmTest < Lazylead::SqliteTest
|
33
|
+
test "convert column to json" do
|
34
|
+
CLI::App.new(Log::NOTHING, NoSchedule.new).run(
|
35
|
+
home: ".",
|
36
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
37
|
+
vcs4sql: "upgrades/sqlite",
|
38
|
+
testdata: true
|
39
|
+
)
|
40
|
+
assert_equal "${usr}", ORM::Team.find(1).to_hash["usr"]
|
41
|
+
end
|
42
|
+
|
43
|
+
test "env properties injected" do
|
44
|
+
ENV["usr"] = "Mike"
|
45
|
+
CLI::App.new(Log::NOTHING, NoSchedule.new).run(
|
46
|
+
home: ".",
|
47
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
48
|
+
vcs4sql: "upgrades/sqlite",
|
49
|
+
testdata: true
|
50
|
+
)
|
51
|
+
assert_equal "Mike",
|
52
|
+
ORM::Team.find(1).env(ORM::Team.find(1).to_hash)["usr"]
|
53
|
+
end
|
54
|
+
|
55
|
+
test "postman initiated through orm" do
|
56
|
+
CLI::App.new(Log::NOTHING, NoSchedule.new).run(
|
57
|
+
home: ".",
|
58
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
59
|
+
vcs4sql: "upgrades/sqlite",
|
60
|
+
testdata: true
|
61
|
+
)
|
62
|
+
assert_kind_of Lazylead::Postman, ORM::Task.find(5).postman
|
63
|
+
end
|
64
|
+
end
|
65
|
+
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/salt"
|
27
|
+
|
28
|
+
module Lazylead
|
29
|
+
class SaltTest < Lazylead::Test
|
30
|
+
test "e2e encryption/decryption is successful" do
|
31
|
+
ENV["s"] = "E1F53135E559C2530000000000000000"
|
32
|
+
assert_equal "the-password",
|
33
|
+
Salt.new("s").decrypt(Salt.new("s").encrypt("the-password"))
|
34
|
+
end
|
35
|
+
|
36
|
+
test "decryption is successful" do
|
37
|
+
ENV["s"] = "E1F53135E559C2530000000000000000"
|
38
|
+
assert_equal "the-best-password",
|
39
|
+
Salt.new("s").decrypt("VUxpSk83d3VGOHZMVTBvWmZ5eGlEOWdPZFhJN0tYMXhwaDd0MVg0L01PST0tLUc0bEhIVTBNRDFzdDdTSkNoeVAyckE9PQ==--4a0206700a28b69aaca65a88af09d211f4251f02")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
|
27
|
+
module Lazylead
|
28
|
+
class EnvTest < Lazylead::Test
|
29
|
+
test "ENV has keys" do
|
30
|
+
ENV["a"] = "aaa"
|
31
|
+
ENV["b"] = "bbb"
|
32
|
+
assert env? "a", "b"
|
33
|
+
end
|
34
|
+
test "ENV has no key" do
|
35
|
+
refute env? "c"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,65 @@
|
|
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/allocated"
|
28
|
+
|
29
|
+
module Lazylead
|
30
|
+
# @todo #43/DEV Minitest+integration test - define approach like maven profile
|
31
|
+
# for java-based applications.
|
32
|
+
class SmtpTest < Lazylead::Test
|
33
|
+
test "email has been sent to the fake server" do
|
34
|
+
Smtp.new.enable
|
35
|
+
Mail.deliver do
|
36
|
+
from "mike@fake.com"
|
37
|
+
to "tom@fake.com"
|
38
|
+
subject "The fake!"
|
39
|
+
body "Fake body"
|
40
|
+
end
|
41
|
+
assert_equal 1,
|
42
|
+
Mail::TestMailer.deliveries
|
43
|
+
.filter { |m| m.subject.eql? "The fake!" }
|
44
|
+
.length
|
45
|
+
end
|
46
|
+
|
47
|
+
# @todo #43/DEV email-related properties should be exported to the CI env
|
48
|
+
test "email has been sent to the remote server" do
|
49
|
+
skip "Not implemented yet" unless env? "LL_SMTP_HOST", "LL_SMTP_USER"
|
50
|
+
Smtp.new(
|
51
|
+
Log::NOTHING, NoSalt.new,
|
52
|
+
smtp_host: ENV["LL_SMTP_HOST"],
|
53
|
+
smtp_port: ENV["LL_SMTP_PORT"],
|
54
|
+
smtp_user: ENV["LL_SMTP_USER"],
|
55
|
+
smtp_pass: ENV["LL_SMTP_PASS"]
|
56
|
+
).enable
|
57
|
+
Mail.deliver do
|
58
|
+
from ENV["LL_SMTP_FROM"]
|
59
|
+
to ENV["LL_SMTP_TO"]
|
60
|
+
subject "Testing"
|
61
|
+
body "Good, it works"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,110 @@
|
|
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/model"
|
27
|
+
require_relative "../../../lib/lazylead/schedule"
|
28
|
+
require_relative "../../../lib/lazylead/cli/app"
|
29
|
+
require_relative "../../../lib/lazylead/system/jira"
|
30
|
+
|
31
|
+
module Lazylead
|
32
|
+
class JiraTest < Lazylead::Test
|
33
|
+
test "found issue by id" do
|
34
|
+
assert_equal "DATAJDBC-480",
|
35
|
+
NoAuthJira.new("https://jira.spring.io")
|
36
|
+
.issues("key in ('DATAJDBC-480')")
|
37
|
+
.first
|
38
|
+
.key
|
39
|
+
end
|
40
|
+
|
41
|
+
test "found issue by jira (ORM)" do
|
42
|
+
skip "No Jira credentials provided" unless env? "jsi_usr", "jsi_psw"
|
43
|
+
CLI::App.new(Log::NOTHING, NoSchedule.new).run(
|
44
|
+
home: ".",
|
45
|
+
sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
|
46
|
+
vcs4sql: "upgrades/sqlite",
|
47
|
+
testdata: true
|
48
|
+
)
|
49
|
+
assert_equal "DATAJDBC-500",
|
50
|
+
ORM::Task.find(4)
|
51
|
+
.system
|
52
|
+
.connect
|
53
|
+
.issues("key in ('DATAJDBC-500')")
|
54
|
+
.first
|
55
|
+
.key,
|
56
|
+
"Id mismatch for https://jira.spring.io/browse/DATAJDBC-500"
|
57
|
+
end
|
58
|
+
|
59
|
+
test "group by assignee" do
|
60
|
+
assert_equal 2,
|
61
|
+
NoAuthJira.new("https://jira.spring.io")
|
62
|
+
.issues("filter=16743")
|
63
|
+
.group_by(&:assignee)
|
64
|
+
.min_by { |a| a.first.id }
|
65
|
+
.length,
|
66
|
+
"Two issues found on remote Jira instance using filter"
|
67
|
+
end
|
68
|
+
|
69
|
+
test "issue reporter fetched successfully" do
|
70
|
+
assert_equal "Mark Paluch",
|
71
|
+
NoAuthJira.new("https://jira.spring.io")
|
72
|
+
.issues("key in ('DATAJDBC-480')")
|
73
|
+
.first
|
74
|
+
.reporter
|
75
|
+
.name
|
76
|
+
end
|
77
|
+
|
78
|
+
test "issue url fetched successfully" do
|
79
|
+
assert_equal "https://jira.spring.io/browse/DATAJDBC-480",
|
80
|
+
NoAuthJira.new("https://jira.spring.io")
|
81
|
+
.issues("key in ('DATAJDBC-480')")
|
82
|
+
.first
|
83
|
+
.url
|
84
|
+
end
|
85
|
+
|
86
|
+
test "issue history found" do
|
87
|
+
greater_or_eq 8,
|
88
|
+
NoAuthJira.new("https://jira.spring.io")
|
89
|
+
.issues("key='DATAJDBC-480'", expand: "changelog")
|
90
|
+
.first
|
91
|
+
.history
|
92
|
+
.size
|
93
|
+
end
|
94
|
+
|
95
|
+
test "issue history not found" do
|
96
|
+
assert_empty NoAuthJira.new("https://jira.spring.io")
|
97
|
+
.issues("key='DATAJDBC-480'")
|
98
|
+
.first
|
99
|
+
.history
|
100
|
+
end
|
101
|
+
|
102
|
+
test "2nd issue history item is correct" do
|
103
|
+
assert_equal "396918",
|
104
|
+
NoAuthJira.new("https://jira.spring.io")
|
105
|
+
.issues("key='DATAJDBC-480'", expand: "changelog")
|
106
|
+
.first
|
107
|
+
.history[2]["id"]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|