Ejemplo n.º 1
0
    def parse_output(command, binary_output):

        if command in ("make-deploy", "sign-deploy"):
            return binary_output

        output = binary_output.decode("utf-8")

        if command in ("deploy", "send-deploy", "bond", "unbond"):
            return output.split()[2]
            # "Success! Deploy 0d4036bebb95de793b28de452d594531a29f8dc3c5394526094d30723fa5ff65 deployed."

        if command in ("propose",):
            # "Response: Success! Block 47338c65992e7d5062aec2200ad8d7284ae49f6c3e7c37fa7eb46fb6fc8ae3d8 created and added."
            return output.split()[3]

        if command == "show-blocks":
            return parse_show_blocks(output)

        if command == "show-deploys":
            return parse_show_deploys(output)

        if command in ("show-deploy", "show-block", "query-state"):
            return parse(output)

        return output
Ejemplo n.º 2
0
    def parse_output(command, binary_output):

        if command in ("make-deploy", "sign-deploy"):
            return binary_output

        output = binary_output.decode("utf-8")

        if command in ("deploy", "send-deploy", "bond", "unbond", "transfer"):
            return output.split()[2]
            # "Success! Deploy 0d4036bebb95de793b28de452d594531a29f8dc3c5394526094d30723fa5ff65 deployed."

        if command == "show-blocks":
            return parse_show_blocks(output)

        if command == "show-deploys":
            return parse_show_deploys(output)

        if command in ("show-deploy", "show-block", "query-state"):
            return parse(output)

        if command in ("balance", ):
            # 'Balance:\n9d39b7fba47d07c1af6f711efe604a112ab371e2deefb99a613d2b3dcdfba414 : 1000000000'
            return int(output.split(":")[-1])

        return output
Ejemplo n.º 3
0
def test_client_parser_list_of_values_of_primitive_types():
    r = parse(
        """
    values: 0
    values: 1
    """
    )

    assert r.values == [0, 1]
Ejemplo n.º 4
0
    def query_state(self, block_hash: str, key: str, path: str, key_type: str):
        """
        Subcommand: query-state - Query a value in the global state.
          -b, --block-hash  <arg>   Hash of the block to query the state of
          -k, --key  <arg>          Base16 encoding of the base key.
          -p, --path  <arg>         Path to the value to query. Must be of the form
                                    'key1/key2/.../keyn'
          -t, --type  <arg>         Type of base key. Must be one of 'hash', 'uref',
                                    'address'
          -h, --help                Show help message

        """
        return parse(
            self.invoke_client(f"query-state "
                               f' --block-hash "{block_hash}"'
                               f' --key "{key}"'
                               f' --path "{path}"'
                               f' --type "{key_type}"'))
Ejemplo n.º 5
0
 def show_deploy(self, hash: str):
     return parse(self.invoke_client(f"show-deploy {hash}"))
Ejemplo n.º 6
0
def test_client_parser_deploy():
    r = parse(DEPLOY)
    assert len(r.processing_results.block_info.summary.header.justifications) == 10