Skip to content
Snippets Groups Projects
Select Git revision
  • release/runtime-701
  • master default protected
  • network/gtest-1000 protected
  • upgradable-multisig
  • runtime/gtest-1000
  • network/gdev-800 protected
  • cgeek/issue-297-cpu
  • gdev-800-tests
  • update-docker-compose-rpc-squid-names
  • fix-252
  • 1000i100-test
  • hugo/tmp-0.9.1
  • network/gdev-803 protected
  • hugo/endpoint-gossip
  • network/gdev-802 protected
  • hugo/distance-precompute
  • network/gdev-900 protected
  • tuxmain/anonymous-tx
  • debug/podman
  • hugo/195-doc
  • hugo/195-graphql-schema
  • gtest-1000-0.11.1 protected
  • gtest-1000-0.11.0 protected
  • gtest-1000 protected
  • gdev-900-0.10.1 protected
  • gdev-900-0.10.0 protected
  • gdev-900-0.9.2 protected
  • gdev-800-0.8.0 protected
  • gdev-900-0.9.1 protected
  • gdev-900-0.9.0 protected
  • gdev-803 protected
  • gdev-802 protected
  • runtime-801 protected
  • gdev-800 protected
  • runtime-800-bis protected
  • runtime-800 protected
  • runtime-800-backup protected
  • runtime-701 protected
  • runtime-700 protected
  • runtime-600 protected
  • runtime-500 protected
41 results

file_header.txt

Blame
    • Éloïs's avatar
      57ac5589
      Add weights benchmarks (step 1) (!73) · 57ac5589
      Éloïs authored
      * feat(weights): use our benchmarks for pallet proxy
      
      * feat(weights): use our benchmarks for pallet multisig
      
      * fix(benchmarks): some pallets benchmarking need access to system.remark
      
      * feat(weights): use our benchmarks for pallet timestamp
      
      * feat(weights): use our benchmarks for pallet scheduler
      
      * fix(weights): impl proper weights & benchmarks for pallet upgrade origin
      
      * doc(dev):weights-bench: reference machine should use an SSD with USB3
      
      * style(clippy): allow unnecessary_cast for WeighInfo implementations
      
      * doc(dev): add "how to benchmarks weights of a Call/Hook/Pallet"
      
      * feat(runtimes): use our benchmarks for pallet universal dividend
      
      * feat(pallet_ud): add weights info
      
      * feat(pallet_ud): add benchmarking
      
      * fix(weights): use our own extrinsic base weights constant
      
      * feat(weights): use our benchmarks for frame_system
      
      * feat(weights): use our benchmarks for pallet balance
      
      * fix(accounts): providers should be inc as soon as the account recv money
      
      providers should be incremented as soon as the account receive funds
      
      * fix(gdev): fix runtime benchmarks compilation
      57ac5589
      History
      Add weights benchmarks (step 1) (!73)
      Éloïs authored
      * feat(weights): use our benchmarks for pallet proxy
      
      * feat(weights): use our benchmarks for pallet multisig
      
      * fix(benchmarks): some pallets benchmarking need access to system.remark
      
      * feat(weights): use our benchmarks for pallet timestamp
      
      * feat(weights): use our benchmarks for pallet scheduler
      
      * fix(weights): impl proper weights & benchmarks for pallet upgrade origin
      
      * doc(dev):weights-bench: reference machine should use an SSD with USB3
      
      * style(clippy): allow unnecessary_cast for WeighInfo implementations
      
      * doc(dev): add "how to benchmarks weights of a Call/Hook/Pallet"
      
      * feat(runtimes): use our benchmarks for pallet universal dividend
      
      * feat(pallet_ud): add weights info
      
      * feat(pallet_ud): add benchmarking
      
      * fix(weights): use our own extrinsic base weights constant
      
      * feat(weights): use our benchmarks for frame_system
      
      * feat(weights): use our benchmarks for pallet balance
      
      * fix(accounts): providers should be inc as soon as the account recv money
      
      providers should be incremented as soon as the account receive funds
      
      * fix(gdev): fix runtime benchmarks compilation
    test_network.py 2.96 KiB
    # Copyright  2016-2025 Maël Azimi <m.a@moul.re>
    #
    # Silkaj is free software: you can redistribute it and/or modify
    # it under the terms of the GNU Affero General Public License as published by
    # the Free Software Foundation, either version 3 of the License, or
    # (at your option) any later version.
    #
    # Silkaj is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    # GNU Affero General Public License for more details.
    #
    # You should have received a copy of the GNU Affero General Public License
    # along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
    
    # import urllib
    # from unittest.mock import patch
    
    import pytest
    
    # from duniterpy.api import bma
    from duniterpy.api import endpoint as du_ep
    
    from silkaj import constants, network
    
    # from silkaj.membership import generate_membership_document
    from tests import helpers
    
    IPV6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
    
    
    @pytest.mark.parametrize(
        ("endpoint", "host", "ipv4", "ipv6", "port", "path"),
        [
            ("127.0.0.1", "", "127.0.0.1", None, 443, None),
            ("127.0.0.1:80", "", "127.0.0.1", None, 80, None),
            ("127.0.0.1:443", "", "127.0.0.1", None, 443, None),
            ("127.0.0.1/path", "", "127.0.0.1", None, 443, "path"),
            ("127.0.0.1:80/path", "", "127.0.0.1", None, 80, "path"),
            ("domain.tld:80/path", "domain.tld", None, None, 80, "path"),
            ("localhost:80/path", "localhost", None, None, 80, "path"),
            (f"[{IPV6}]", None, None, IPV6, 443, None),
            (f"[{IPV6}]/path", None, None, IPV6, 443, "path"),
            (f"[{IPV6}]:80/path", None, None, IPV6, 80, "path"),
        ],
    )
    def test_determine_endpoint_custom(endpoint, host, ipv4, ipv6, port, path):
        helpers.define_click_context(endpoint=endpoint)
        ep = network.determine_endpoint()
        assert ep.host == host
        assert ep.ipv4 == ipv4
        assert ep.ipv6 == ipv6
        assert ep.port == port
        if isinstance(ep, du_ep.SecuredBMAEndpoint):
            assert ep.path == path
    
    
    @pytest.mark.parametrize(
        ("gtest", "endpoint"),
        [
            (True, constants.G1_TEST_DEFAULT_ENDPOINT),
            (False, constants.G1_DEFAULT_ENDPOINT),
        ],
    )
    def test_determine_endpoint(gtest, endpoint):
        helpers.define_click_context(gtest=gtest)
        ep = network.determine_endpoint()
        assert ep == du_ep.endpoint(endpoint)
    
    
    # def test_send_document_success(capsys):
    #    display = capsys.readouterr().out
    #    network.send_document()
    
    
    # def test_send_document_error(capsys):
    #    membership_doc = generate_membership_document(
    #        "g1", "A" * 43, "0-ahv", "test", "1-aut"
    #    )
    #
    #    #with patch("urllib.request.urlopen", side_effect=urllib.error.HTTPError):
    #    with patch("duniterpy.api.client.API.request_url", side_effect=urllib.error.HTTPError):
    #        network.send_document(bma.blockchain.membership, membership_doc)
    #
    #    display = capsys.readouterr().out
    #    assert "Error while publishing Membership:" in display