zold 0.31.10 → 0.32.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/.0pdd.yml +2 -19
- data/.github/typos.toml +11 -0
- data/.github/workflows/actionlint.yml +5 -21
- data/.github/workflows/bashate.yml +25 -0
- data/.github/workflows/codecov.yml +11 -24
- data/.github/workflows/copyrights.yml +6 -21
- data/.github/workflows/hadolint.yml +14 -0
- data/.github/workflows/markdown-lint.yml +19 -0
- data/.github/workflows/pdd.yml +5 -20
- data/.github/workflows/rake.yml +8 -22
- data/.github/workflows/reuse.yml +19 -0
- data/.github/workflows/shellcheck.yml +19 -0
- data/.github/workflows/typos.yml +21 -0
- data/.github/workflows/xcop.yml +5 -20
- data/.github/workflows/yamllint.yml +5 -20
- data/.gitignore +9 -6
- data/.rubocop.yml +16 -20
- data/.ruby-version +1 -1
- data/.rultor.yml +6 -22
- data/Dockerfile +11 -27
- data/Gemfile +21 -33
- data/Gemfile.lock +181 -126
- data/Guardfile +0 -0
- data/INSTALL.md +80 -59
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +183 -154
- data/REUSE.toml +40 -0
- data/Rakefile +4 -38
- data/bin/zold +7 -37
- data/cucumber.yml +2 -19
- data/deploy.sh +4 -22
- data/features/cli.feature +2 -0
- data/features/gem_package.feature +2 -0
- data/features/step_definitions/steps.rb +2 -19
- data/features/support/env.rb +2 -19
- data/fixtures/merge/asserts.rb +3 -19
- data/fixtures/merge/into_no_wallet/assert.rb +2 -19
- data/fixtures/merge/legacy_negatives_stay/assert.rb +2 -19
- data/fixtures/merge/legacy_negatives_stay/copies/0123456789abcdef/scores.zc +1 -1
- data/fixtures/merge/missed_wallets/0123456789abcdef.z +0 -2
- data/fixtures/merge/missed_wallets/assert.rb +2 -19
- data/fixtures/merge/missed_wallets/copies/0123456789abcdef/scores.zc +1 -1
- data/fixtures/merge/negative_overwriting/assert.rb +2 -19
- data/fixtures/merge/negatives_in_between/0123456789abcdef.z +0 -1
- data/fixtures/merge/negatives_in_between/assert.rb +2 -19
- data/fixtures/merge/negatives_in_between/copies/0123456789abcdef/2.zc +0 -1
- data/fixtures/merge/negatives_in_between/opts +1 -1
- data/fixtures/merge/random_expenses/assert.rb +2 -19
- data/fixtures/merge/random_expenses/opts +1 -1
- data/fixtures/merge/simple_case/assert.rb +2 -19
- data/fixtures/merge/simple_case/opts +1 -1
- data/fixtures/merge/unconfirmed_income/assert.rb +2 -19
- data/fixtures/scripts/_head.sh +16 -33
- data/fixtures/scripts/calculate-scores.sh +3 -20
- data/fixtures/scripts/distribute-wallet.sh +26 -43
- data/fixtures/scripts/print-helps.sh +5 -23
- data/fixtures/scripts/pull-on-start.sh +12 -29
- data/fixtures/scripts/push-and-pull.sh +10 -27
- data/fixtures/scripts/redeploy-on-upgrade.sh +18 -34
- data/fixtures/scripts/spread-wallets.sh +24 -40
- data/lib/zold/age.rb +3 -20
- data/lib/zold/amount.rb +3 -20
- data/lib/zold/cached_wallets.rb +3 -20
- data/lib/zold/commands/alias.rb +4 -21
- data/lib/zold/commands/args.rb +4 -21
- data/lib/zold/commands/calculate.rb +5 -22
- data/lib/zold/commands/clean.rb +6 -23
- data/lib/zold/commands/create.rb +5 -22
- data/lib/zold/commands/diff.rb +5 -22
- data/lib/zold/commands/fetch.rb +6 -23
- data/lib/zold/commands/invoice.rb +5 -22
- data/lib/zold/commands/list.rb +5 -22
- data/lib/zold/commands/merge.rb +7 -24
- data/lib/zold/commands/next.rb +5 -22
- data/lib/zold/commands/node.rb +4 -21
- data/lib/zold/commands/pay.rb +6 -23
- data/lib/zold/commands/propagate.rb +5 -22
- data/lib/zold/commands/pull.rb +5 -22
- data/lib/zold/commands/push.rb +5 -22
- data/lib/zold/commands/remote.rb +7 -24
- data/lib/zold/commands/remove.rb +5 -22
- data/lib/zold/commands/routines/audit.rb +4 -21
- data/lib/zold/commands/routines/gc.rb +6 -23
- data/lib/zold/commands/routines/reconcile.rb +5 -22
- data/lib/zold/commands/routines/reconnect.rb +4 -21
- data/lib/zold/commands/routines/retire.rb +4 -21
- data/lib/zold/commands/routines/spread.rb +5 -22
- data/lib/zold/commands/routines.rb +3 -20
- data/lib/zold/commands/show.rb +5 -22
- data/lib/zold/commands/taxes.rb +5 -22
- data/lib/zold/commands/thread_badge.rb +3 -20
- data/lib/zold/copies.rb +6 -25
- data/lib/zold/dir_items.rb +3 -20
- data/lib/zold/endless.rb +5 -22
- data/lib/zold/gem.rb +3 -20
- data/lib/zold/hands.rb +6 -23
- data/lib/zold/head.rb +4 -21
- data/lib/zold/hexnum.rb +3 -20
- data/lib/zold/http.rb +3 -20
- data/lib/zold/hungry_wallets.rb +6 -23
- data/lib/zold/id.rb +3 -20
- data/lib/zold/json_page.rb +5 -22
- data/lib/zold/key.rb +3 -20
- data/lib/zold/metronome.rb +5 -22
- data/lib/zold/node/async_entrance.rb +6 -23
- data/lib/zold/node/entrance.rb +7 -24
- data/lib/zold/node/farm.rb +5 -22
- data/lib/zold/node/farmers.rb +15 -32
- data/lib/zold/node/front.rb +6 -23
- data/lib/zold/node/journaled_pipeline.rb +8 -25
- data/lib/zold/node/nodup_entrance.rb +6 -23
- data/lib/zold/node/nospam_entrance.rb +6 -23
- data/lib/zold/node/pipeline.rb +6 -23
- data/lib/zold/node/safe_entrance.rb +4 -22
- data/lib/zold/node/soft_error.rb +3 -20
- data/lib/zold/node/spread_entrance.rb +5 -22
- data/lib/zold/node/sync_entrance.rb +5 -22
- data/lib/zold/node/trace.rb +3 -20
- data/lib/zold/patch.rb +6 -23
- data/lib/zold/prefixes.rb +3 -20
- data/lib/zold/remotes.rb +5 -22
- data/lib/zold/signature.rb +3 -20
- data/lib/zold/size.rb +3 -20
- data/lib/zold/sync_wallets.rb +5 -22
- data/lib/zold/tax.rb +4 -21
- data/lib/zold/thread_pool.rb +4 -21
- data/lib/zold/tree_wallets.rb +3 -20
- data/lib/zold/txn.rb +4 -21
- data/lib/zold/txns.rb +4 -21
- data/lib/zold/upgrades.rb +4 -21
- data/lib/zold/verbose_thread.rb +5 -22
- data/lib/zold/version.rb +4 -21
- data/lib/zold/version_file.rb +4 -21
- data/lib/zold/wallet.rb +6 -23
- data/lib/zold/wallets.rb +5 -23
- data/lib/zold.rb +3 -21
- data/resources/banned-wallets.log +6 -6
- data/test/commands/routines/test_audit.rb +3 -21
- data/test/commands/routines/test_gc.rb +3 -21
- data/test/commands/routines/test_reconcile.rb +3 -21
- data/test/commands/routines/test_reconnect.rb +3 -21
- data/test/commands/routines/test_retire.rb +3 -21
- data/test/commands/test_alias.rb +2 -20
- data/test/commands/test_calculate.rb +5 -23
- data/test/commands/test_clean.rb +5 -23
- data/test/commands/test_create.rb +6 -24
- data/test/commands/test_diff.rb +4 -22
- data/test/commands/test_fetch.rb +3 -21
- data/test/commands/test_invoice.rb +3 -21
- data/test/commands/test_list.rb +3 -21
- data/test/commands/test_merge.rb +12 -35
- data/test/commands/test_node.rb +3 -21
- data/test/commands/test_pay.rb +5 -23
- data/test/commands/test_propagate.rb +6 -24
- data/test/commands/test_pull.rb +4 -22
- data/test/commands/test_push.rb +3 -21
- data/test/commands/test_remote.rb +10 -28
- data/test/commands/test_remove.rb +7 -25
- data/test/commands/test_show.rb +3 -21
- data/test/commands/test_taxes.rb +5 -23
- data/test/fake_home.rb +5 -22
- data/test/node/fake_entrance.rb +3 -20
- data/test/node/fake_node.rb +5 -22
- data/test/node/test_async_entrance.rb +3 -21
- data/test/node/test_entrance.rb +7 -25
- data/test/node/test_farm.rb +15 -33
- data/test/node/test_farmers.rb +3 -21
- data/test/node/test_front.rb +22 -42
- data/test/node/test_nodup_entrance.rb +4 -22
- data/test/node/test_nospam_entrance.rb +6 -24
- data/test/node/test_safe_entrance.rb +3 -21
- data/test/node/test_spread_entrance.rb +4 -22
- data/test/node/test_sync_entrance.rb +4 -22
- data/test/node/test_trace.rb +4 -22
- data/test/test__helper.rb +32 -31
- data/test/test_age.rb +5 -23
- data/test/test_amount.rb +15 -34
- data/test/test_cached_wallets.rb +3 -21
- data/test/test_copies.rb +10 -28
- data/test/test_dir_items.rb +4 -22
- data/test/test_gem.rb +3 -21
- data/test/test_hands.rb +3 -21
- data/test/test_hexnum.rb +3 -21
- data/test/test_http.rb +9 -27
- data/test/test_hungry_wallets.rb +6 -24
- data/test/test_id.rb +10 -28
- data/test/test_json_page.rb +3 -21
- data/test/test_key.rb +5 -23
- data/test/test_metronome.rb +6 -24
- data/test/test_patch.rb +10 -28
- data/test/test_prefixes.rb +3 -21
- data/test/test_remotes.rb +17 -35
- data/test/test_signature.rb +3 -21
- data/test/test_size.rb +3 -21
- data/test/test_sync_wallets.rb +3 -21
- data/test/test_tax.rb +6 -24
- data/test/test_thread_pool.rb +6 -24
- data/test/test_tree_wallets.rb +4 -22
- data/test/test_txn.rb +3 -21
- data/test/test_upgrades.rb +3 -21
- data/test/test_verbose_thread.rb +6 -24
- data/test/test_version.rb +2 -20
- data/test/test_wallet.rb +15 -33
- data/test/test_wallets.rb +4 -22
- data/test/test_zold.rb +7 -25
- data/test/upgrades/test_delete_banned_wallets.rb +4 -22
- data/test/upgrades/test_protocol_up.rb +3 -21
- data/upgrades/2.rb +3 -20
- data/upgrades/delete_banned_wallets.rb +3 -20
- data/upgrades/move_wallets_into_tree.rb +3 -20
- data/upgrades/protocol_up.rb +3 -20
- data/upgrades/rename_foreign_wallets.rb +3 -20
- data/views/journal.haml +25 -0
- data/views/layout.haml +25 -0
- data/views/wallet.haml +25 -0
- data/zold.gemspec +5 -21
- metadata +33 -15
- data/.simplecov +0 -36
- data/lib/zold/log.rb +0 -139
- data/test/test_log.rb +0 -49
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require_relative '../test__helper'
|
|
26
8
|
require_relative '../../lib/zold/wallets'
|
|
@@ -29,7 +11,7 @@ require_relative '../../lib/zold/commands/create'
|
|
|
29
11
|
|
|
30
12
|
# CREATE test.
|
|
31
13
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
32
|
-
# Copyright:: Copyright (c) 2018-
|
|
14
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
33
15
|
# License:: MIT
|
|
34
16
|
class TestCreate < Zold::Test
|
|
35
17
|
def test_creates_wallet
|
|
@@ -39,9 +21,9 @@ class TestCreate < Zold::Test
|
|
|
39
21
|
['create', '--public-key=fixtures/id_rsa.pub', '--skip-test']
|
|
40
22
|
)
|
|
41
23
|
wallets.acq(id) do |wallet|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
File.
|
|
24
|
+
assert_predicate(wallet.balance, :zero?)
|
|
25
|
+
assert_path_exists(
|
|
26
|
+
File.join(dir, "#{wallet.id}#{Zold::Wallet::EXT}"),
|
|
45
27
|
"Wallet file not found: #{wallet.id}#{Zold::Wallet::EXT}"
|
|
46
28
|
)
|
|
47
29
|
end
|
data/test/commands/test_diff.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'json'
|
|
25
7
|
require 'time'
|
|
26
8
|
require 'webmock/minitest'
|
|
@@ -36,7 +18,7 @@ require_relative '../../lib/zold/commands/diff'
|
|
|
36
18
|
|
|
37
19
|
# DIFF test.
|
|
38
20
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
39
|
-
# Copyright:: Copyright (c) 2018-
|
|
21
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
40
22
|
# License:: MIT
|
|
41
23
|
class TestDiff < Zold::Test
|
|
42
24
|
def test_diff_with_copies
|
|
@@ -55,7 +37,7 @@ class TestDiff < Zold::Test
|
|
|
55
37
|
diff = Zold::Diff.new(wallets: home.wallets, copies: copies.root, log: fake_log).run(
|
|
56
38
|
['diff', wallet.id.to_s]
|
|
57
39
|
)
|
|
58
|
-
|
|
40
|
+
assert_includes(diff, '-0001;', diff)
|
|
59
41
|
end
|
|
60
42
|
end
|
|
61
43
|
end
|
data/test/commands/test_fetch.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require 'json'
|
|
26
8
|
require 'time'
|
|
@@ -38,7 +20,7 @@ require_relative '../../lib/zold/commands/fetch'
|
|
|
38
20
|
|
|
39
21
|
# FETCH test.
|
|
40
22
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
41
|
-
# Copyright:: Copyright (c) 2018-
|
|
23
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
42
24
|
# License:: MIT
|
|
43
25
|
class TestFetch < Zold::Test
|
|
44
26
|
def test_fetches_wallet
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require_relative '../test__helper'
|
|
26
8
|
require_relative '../../lib/zold/wallets'
|
|
@@ -31,7 +13,7 @@ require_relative '../../lib/zold/commands/invoice'
|
|
|
31
13
|
|
|
32
14
|
# INVOICE test.
|
|
33
15
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
34
|
-
# Copyright:: Copyright (c) 2018-
|
|
16
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
35
17
|
# License:: MIT
|
|
36
18
|
class TestInvoice < Zold::Test
|
|
37
19
|
def test_generates_invoice
|
data/test/commands/test_list.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require_relative '../test__helper'
|
|
26
8
|
require_relative '../../lib/zold/wallet'
|
|
@@ -31,7 +13,7 @@ require_relative '../../lib/zold/commands/list'
|
|
|
31
13
|
|
|
32
14
|
# LIST test.
|
|
33
15
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
34
|
-
# Copyright:: Copyright (c) 2018-
|
|
16
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
35
17
|
# License:: MIT
|
|
36
18
|
class TestList < Zold::Test
|
|
37
19
|
def test_lists_wallets_with_balances
|
data/test/commands/test_merge.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require 'time'
|
|
26
8
|
require 'webmock/minitest'
|
|
@@ -39,27 +21,22 @@ require_relative '../../lib/zold/commands/pay'
|
|
|
39
21
|
|
|
40
22
|
# MERGE test.
|
|
41
23
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
42
|
-
# Copyright:: Copyright (c) 2018-
|
|
24
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
43
25
|
# License:: MIT
|
|
44
26
|
class TestMerge < Zold::Test
|
|
45
27
|
def test_merges_wallet
|
|
46
28
|
FakeHome.new(log: fake_log).run do |home|
|
|
47
29
|
wallet = home.create_wallet
|
|
48
|
-
first = home.create_wallet
|
|
49
|
-
File.write(first.path, File.read(wallet.path))
|
|
50
|
-
second = home.create_wallet
|
|
51
|
-
File.write(second.path, File.read(wallet.path))
|
|
52
30
|
Zold::Pay.new(wallets: home.wallets, copies: home.dir, remotes: home.remotes, log: fake_log).run(
|
|
53
31
|
['pay', wallet.id.to_s, "NOPREFIX@#{Zold::Id.new}", '14.95', '--force', '--private-key=fixtures/id_rsa']
|
|
54
32
|
)
|
|
55
33
|
copies = home.copies(wallet)
|
|
56
|
-
copies.add(File.read(
|
|
57
|
-
copies.add(File.read(
|
|
34
|
+
copies.add(File.read(wallet.path), 'host-1', 80, 5)
|
|
35
|
+
copies.add(File.read(wallet.path), 'host-2', 80, 5)
|
|
58
36
|
modified = Zold::Merge.new(wallets: home.wallets, remotes: home.remotes, copies: copies.root, log: fake_log).run(
|
|
59
|
-
['merge', wallet.id.to_s]
|
|
37
|
+
['merge', wallet.id.to_s, '--allow-negative-balance']
|
|
60
38
|
)
|
|
61
|
-
|
|
62
|
-
assert(wallet.id, modified[0])
|
|
39
|
+
assert_empty(modified)
|
|
63
40
|
end
|
|
64
41
|
end
|
|
65
42
|
|
|
@@ -72,7 +49,7 @@ class TestMerge < Zold::Test
|
|
|
72
49
|
modified = Zold::Merge.new(wallets: home.wallets, remotes: home.remotes, copies: copies.root, log: fake_log).run(
|
|
73
50
|
['merge', wallet.id.to_s]
|
|
74
51
|
)
|
|
75
|
-
|
|
52
|
+
assert_empty(modified)
|
|
76
53
|
end
|
|
77
54
|
end
|
|
78
55
|
|
|
@@ -86,7 +63,7 @@ class TestMerge < Zold::Test
|
|
|
86
63
|
Zold::Merge.new(wallets: home.wallets, remotes: home.remotes, copies: copies.root, log: fake_log).run(
|
|
87
64
|
['merge', wallet.id.to_s]
|
|
88
65
|
)
|
|
89
|
-
|
|
66
|
+
refute_predicate(wallet.balance, :zero?)
|
|
90
67
|
end
|
|
91
68
|
end
|
|
92
69
|
|
|
@@ -105,6 +82,7 @@ class TestMerge < Zold::Test
|
|
|
105
82
|
end
|
|
106
83
|
end
|
|
107
84
|
|
|
85
|
+
BASE_CMD = %w[merge 0123456789abcdef].freeze
|
|
108
86
|
base = 'fixtures/merge'
|
|
109
87
|
Dir.new(base).select { |f| File.directory?(File.join(base, f)) && !f.start_with?('.') }.each do |f|
|
|
110
88
|
method = "test_#{f}"
|
|
@@ -117,9 +95,8 @@ class TestMerge < Zold::Test
|
|
|
117
95
|
wallets = Zold::Wallets.new(dir)
|
|
118
96
|
copies = File.join(dir, 'copies')
|
|
119
97
|
remotes = Zold::Remotes.new(file: File.join(dir, 'remotes'))
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
98
|
+
cmd = BASE_CMD + File.read(File.join(dir, 'opts')).split("\n")
|
|
99
|
+
Zold::Merge.new(wallets: wallets, remotes: remotes, copies: copies, log: fake_log).run(cmd)
|
|
123
100
|
Dir.chdir(dir) do
|
|
124
101
|
require File.join(dir, 'assert.rb')
|
|
125
102
|
end
|
data/test/commands/test_node.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require 'webmock/minitest'
|
|
26
8
|
require_relative '../test__helper'
|
|
@@ -36,7 +18,7 @@ require_relative '../node/fake_node'
|
|
|
36
18
|
|
|
37
19
|
# NODE test.
|
|
38
20
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
39
|
-
# Copyright:: Copyright (c) 2018-
|
|
21
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
40
22
|
# License:: MIT
|
|
41
23
|
class TestNode < Zold::Test
|
|
42
24
|
def test_push_and_fetch
|
data/test/commands/test_pay.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'webmock/minitest'
|
|
25
7
|
require 'threads'
|
|
26
8
|
require 'shellwords'
|
|
@@ -35,7 +17,7 @@ require_relative '../../lib/zold/commands/pay'
|
|
|
35
17
|
|
|
36
18
|
# PAY test.
|
|
37
19
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
38
|
-
# Copyright:: Copyright (c) 2018-
|
|
20
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
39
21
|
# License:: MIT
|
|
40
22
|
class TestPay < Zold::Test
|
|
41
23
|
def test_sends_from_wallet_to_wallet
|
|
@@ -176,7 +158,7 @@ class TestPay < Zold::Test
|
|
|
176
158
|
source.id.to_s, target.id.to_s, amount.to_zld, 'For the car'
|
|
177
159
|
]
|
|
178
160
|
)
|
|
179
|
-
assert_equal accumulating_log.info_messages.grep(/^The tax debt/).size,
|
|
161
|
+
assert_equal 1, accumulating_log.info_messages.grep(/^The tax debt/).size,
|
|
180
162
|
'No info_messages notified user of tax debt'
|
|
181
163
|
end
|
|
182
164
|
end
|
|
@@ -215,7 +197,7 @@ class TestPay < Zold::Test
|
|
|
215
197
|
]
|
|
216
198
|
)
|
|
217
199
|
wallet.flush
|
|
218
|
-
|
|
200
|
+
refute_equal(before.to_zld(6), wallet.balance.to_zld(6))
|
|
219
201
|
end
|
|
220
202
|
end
|
|
221
203
|
end
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require_relative '../test__helper'
|
|
25
7
|
require_relative '../fake_home'
|
|
26
8
|
require_relative '../../lib/zold/amount'
|
|
@@ -29,7 +11,7 @@ require_relative '../../lib/zold/commands/pay'
|
|
|
29
11
|
|
|
30
12
|
# PROPAGATE test.
|
|
31
13
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
32
|
-
# Copyright:: Copyright (c) 2018-
|
|
14
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
33
15
|
# License:: MIT
|
|
34
16
|
class TestPropagate < Zold::Test
|
|
35
17
|
def test_propagates_wallet
|
|
@@ -43,9 +25,9 @@ class TestPropagate < Zold::Test
|
|
|
43
25
|
Zold::Propagate.new(wallets: home.wallets, log: fake_log).run(
|
|
44
26
|
['merge', wallet.id.to_s]
|
|
45
27
|
)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
assert_equal(amount, friend.balance)
|
|
29
|
+
assert_equal(1, friend.txns.count)
|
|
30
|
+
assert_equal('', friend.txns[0].sign)
|
|
49
31
|
end
|
|
50
32
|
end
|
|
51
33
|
end
|
data/test/commands/test_pull.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'webmock/minitest'
|
|
25
7
|
require_relative '../fake_home'
|
|
26
8
|
require_relative '../test__helper'
|
|
@@ -30,7 +12,7 @@ require_relative '../../lib/zold/commands/pull'
|
|
|
30
12
|
|
|
31
13
|
# PUSH test.
|
|
32
14
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
33
|
-
# Copyright:: Copyright (c) 2018-
|
|
15
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
34
16
|
# License:: MIT
|
|
35
17
|
class TestPull < Zold::Test
|
|
36
18
|
def test_pull_wallet
|
|
@@ -46,7 +28,7 @@ class TestPull < Zold::Test
|
|
|
46
28
|
['--ignore-this-stupid-option', 'pull', id.to_s, '--tolerate-edges', '--tolerate-quorum=1']
|
|
47
29
|
)
|
|
48
30
|
home.wallets.acq(Zold::Id.new(id)) do |wallet|
|
|
49
|
-
|
|
31
|
+
assert_predicate(wallet, :exists?)
|
|
50
32
|
end
|
|
51
33
|
end
|
|
52
34
|
end
|
data/test/commands/test_push.rb
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'webmock/minitest'
|
|
25
7
|
require_relative '../fake_home'
|
|
26
8
|
require_relative '../test__helper'
|
|
@@ -33,7 +15,7 @@ require_relative '../../lib/zold/commands/push'
|
|
|
33
15
|
|
|
34
16
|
# PUSH test.
|
|
35
17
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
36
|
-
# Copyright:: Copyright (c) 2018-
|
|
18
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
37
19
|
# License:: MIT
|
|
38
20
|
class TestPush < Zold::Test
|
|
39
21
|
def test_pushes_wallet
|
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2018-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2018-2025 Zerocracy
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
|
-
require 'minitest/autorun'
|
|
24
6
|
require 'tmpdir'
|
|
25
7
|
require 'webmock/minitest'
|
|
26
8
|
require 'zold/score'
|
|
@@ -29,12 +11,12 @@ require_relative '../../lib/zold/version'
|
|
|
29
11
|
require_relative '../../lib/zold/wallets'
|
|
30
12
|
require_relative '../../lib/zold/remotes'
|
|
31
13
|
require_relative '../../lib/zold/key'
|
|
32
|
-
|
|
14
|
+
require 'loog'
|
|
33
15
|
require_relative '../../lib/zold/commands/remote'
|
|
34
16
|
|
|
35
17
|
# REMOTE test.
|
|
36
18
|
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
37
|
-
# Copyright:: Copyright (c) 2018-
|
|
19
|
+
# Copyright:: Copyright (c) 2018-2025 Zerocracy
|
|
38
20
|
# License:: MIT
|
|
39
21
|
class TestRemote < Zold::Test
|
|
40
22
|
def test_updates_remote
|
|
@@ -69,7 +51,7 @@ class TestRemote < Zold::Test
|
|
|
69
51
|
)
|
|
70
52
|
cmd = Zold::Remote.new(remotes: remotes, log: fake_log)
|
|
71
53
|
cmd.run(%w[remote clean])
|
|
72
|
-
|
|
54
|
+
assert_empty(remotes.all)
|
|
73
55
|
cmd.run(['remote', 'add', zero.host, zero.port.to_s, '--skip-ping'])
|
|
74
56
|
cmd.run(%w[remote add localhost 2 --skip-ping])
|
|
75
57
|
assert_equal(2, remotes.all.count)
|
|
@@ -102,14 +84,14 @@ class TestRemote < Zold::Test
|
|
|
102
84
|
cmd.run(%w[remote clean])
|
|
103
85
|
cmd.run(['remote', 'add', zero.host, zero.port.to_s, '--skip-ping'])
|
|
104
86
|
cmd.run(['remote', 'update', '--ignore-score-weakness', '--skip-ping', '--reboot'])
|
|
105
|
-
|
|
87
|
+
assert_includes(log.msgs.to_s, ', reboot!')
|
|
106
88
|
log.msgs = []
|
|
107
89
|
stub_request(:get, 'https://rubygems.org/api/v1/versions/zold/latest.json').to_return(
|
|
108
90
|
status: 200,
|
|
109
91
|
body: "{\"version\": \"#{Zold::VERSION}\"}"
|
|
110
92
|
)
|
|
111
93
|
cmd.run(['remote', 'update', '--ignore-score-weakness', '--skip-ping', '--reboot'])
|
|
112
|
-
|
|
94
|
+
refute_includes(log.msgs.to_s, ', reboot!')
|
|
113
95
|
end
|
|
114
96
|
end
|
|
115
97
|
|
|
@@ -166,7 +148,7 @@ class TestRemote < Zold::Test
|
|
|
166
148
|
stub_request(:get, 'http://localhost:8883/remotes').to_return(status: 404)
|
|
167
149
|
cmd = Zold::Remote.new(remotes: remotes, log: fake_log)
|
|
168
150
|
cmd.run(%w[remote clean])
|
|
169
|
-
|
|
151
|
+
assert_empty(remotes.all)
|
|
170
152
|
cmd.run(['remote', 'add', score.host, score.port.to_s, '--skip-ping'])
|
|
171
153
|
cmd.run(['remote', 'update', '--ignore-score-weakness', '--skip-ping'])
|
|
172
154
|
assert_equal(2, remotes.all.count)
|
|
@@ -228,7 +210,7 @@ class TestRemote < Zold::Test
|
|
|
228
210
|
remotes = Zold::Remotes.new(file: File.join(dir, 'remotes.txt'))
|
|
229
211
|
cmd = Zold::Remote.new(remotes: remotes, log: fake_log)
|
|
230
212
|
cmd.run(%w[remote masters])
|
|
231
|
-
|
|
213
|
+
refute_empty(remotes.all)
|
|
232
214
|
end
|
|
233
215
|
end
|
|
234
216
|
|
|
@@ -238,7 +220,7 @@ class TestRemote < Zold::Test
|
|
|
238
220
|
cmd = Zold::Remote.new(remotes: remotes, log: fake_log)
|
|
239
221
|
cmd.run(%w[remote masters])
|
|
240
222
|
cmd.run(%w[remote select --max-nodes=0])
|
|
241
|
-
|
|
223
|
+
refute_empty(remotes.all)
|
|
242
224
|
end
|
|
243
225
|
end
|
|
244
226
|
|