示例#1
0
    def test_single_transaction(self):
        """
    Getting a bundle that contains a single transaction.
    """
        transaction = \
            Transaction(
                current_index=0,
                last_index=0,
                tag=Tag(b''),
                timestamp=1484960990,
                value=0,
                attachment_timestamp=1484960990,
                attachment_timestamp_lower_bound=12,
                attachment_timestamp_upper_bound=0,

                # These values are not relevant for 0-value transactions.
                nonce=Nonce(b''),
                signature_message_fragment=Fragment(b''),

                # This value is computed automatically, so it has to be real.
                hash_=TransactionHash(
                    b'XPJIYZWPF9LBCYZPNBFARDRCSUGJGF9TWZT9K9PX'
                    b'VYDFPZOZBGXUCKLTJEUCFBEKQQ9VCSQVQDMMJQAY9',
                ),

                address=Address(
                    b'TESTVALUE9DONTUSEINPRODUCTION99999OCSGVF'
                    b'IBQA99KGTCPCZ9NHR9VGLGADDDIEGGPCGBDEDDTBC',
                ),

                bundle_hash=BundleHash(
                    b'TESTVALUE9DONTUSEINPRODUCTION99999DIOAZD'
                    b'M9AIUHXGVGBC9EMGI9SBVBAIXCBFJ9EELCPDRAD9U',
                ),

                branch_transaction_hash=TransactionHash(
                    b'TESTVALUE9DONTUSEINPRODUCTION99999BBCEDI'
                    b'ZHUDWBYDJEXHHAKDOCKEKDFIMB9AMCLFW9NBDEOFV',
                ),

                trunk_transaction_hash=TransactionHash(
                    b'TESTVALUE9DONTUSEINPRODUCTION999999ARAYA'
                    b'MHCB9DCFEIWEWDLBCDN9LCCBQBKGDDAECFIAAGDAS',
                ),
            )

        self.adapter.seed_response('getTrytes', {
            'trytes': [transaction.as_tryte_string()],
        })

        response = self.command(transaction=transaction.hash)

        bundle = response['bundles'][0]  # type: Bundle
        self.assertEqual(len(bundle), 1)

        self.maxDiff = None
        self.assertDictEqual(
            bundle[0].as_json_compatible(),
            transaction.as_json_compatible(),
        )
示例#2
0
    def test_single_transaction(self):
        """
    Getting a bundle that contains a single transaction.
    """
        transaction =\
          Transaction(
              current_index = 0,
              last_index    = 0,
              tag           = Tag(b''),
              timestamp     = 1484960990,
              value         = 0,

              # These values are not relevant for 0-value transactions.
              nonce                       = Hash(b''),
              signature_message_fragment  = Fragment(b''),

              # This value is computed automatically, so it has to be real.
              hash_ =
                TransactionHash(
                  b'UGQBSMKGNXXWDCS9XZCFTPUXFADCT9I9KCNQGUXK'
                  b'NDJDUXLWODOVJQWJHCLWTODAELDXGL9SMQYQZFWHE',
                ),

              address =
                Address(
                  b'TESTVALUE9DONTUSEINPRODUCTION99999OCSGVF'
                  b'IBQA99KGTCPCZ9NHR9VGLGADDDIEGGPCGBDEDDTBC',
                ),

              bundle_hash =
                BundleHash(
                  b'TESTVALUE9DONTUSEINPRODUCTION99999DIOAZD'
                  b'M9AIUHXGVGBC9EMGI9SBVBAIXCBFJ9EELCPDRAD9U',
                ),

              branch_transaction_hash =
                TransactionHash(
                  b'TESTVALUE9DONTUSEINPRODUCTION99999BBCEDI'
                  b'ZHUDWBYDJEXHHAKDOCKEKDFIMB9AMCLFW9NBDEOFV',
                ),

              trunk_transaction_hash =
                TransactionHash(
                  b'TESTVALUE9DONTUSEINPRODUCTION999999ARAYA'
                  b'MHCB9DCFEIWEWDLBCDN9LCCBQBKGDDAECFIAAGDAS',
                ),
            )

        self.adapter.seed_response('getTrytes', {
            'trytes': [transaction.as_tryte_string()],
        })

        response = self.command(transaction=transaction.hash)

        bundle = response['bundles'][0]  # type: Bundle
        self.assertEqual(len(bundle), 1)

        self.maxDiff = None
        self.assertDictEqual(
            bundle[0].as_json_compatible(),
            transaction.as_json_compatible(),
        )
示例#3
0
    def test_single_transaction(self):
        """
    Getting a bundle that contains a single transaction.
    """
        transaction =\
          Transaction(
              current_index = 0,
              last_index    = 0,
              tag           = Tag(b''),
              timestamp     = 1484960990,
              value         = 0,

              # These values are not relevant for 0-value transactions.
              nonce                       = Hash(b''),
              signature_message_fragment  = Fragment(b''),

              # This value is computed automatically, so it has to be real.
              hash_ =
                TransactionHash(
                  b'TAOICZV9ZSXIZINMNRLOLCWNLL9IDKGVWTJITNGU'
                  b'HAIKLHZLBZWOQ9HJSODUDISTYGIYPWTYDCFMVRBQN'
                ),

              address =
                Address(
                  b'TESTVALUE9DONTUSEINPRODUCTION99999OCSGVF'
                  b'IBQA99KGTCPCZ9NHR9VGLGADDDIEGGPCGBDEDDTBC'
                ),

              bundle_hash =
                BundleHash(
                  b'TESTVALUE9DONTUSEINPRODUCTION99999DIOAZD'
                  b'M9AIUHXGVGBC9EMGI9SBVBAIXCBFJ9EELCPDRAD9U'
                ),

              branch_transaction_hash =
                TransactionHash(
                  b'TESTVALUE9DONTUSEINPRODUCTION99999BBCEDI'
                  b'ZHUDWBYDJEXHHAKDOCKEKDFIMB9AMCLFW9NBDEOFV'
                ),

              trunk_transaction_hash =
                TransactionHash(
                  b'TESTVALUE9DONTUSEINPRODUCTION999999ARAYA'
                  b'MHCB9DCFEIWEWDLBCDN9LCCBQBKGDDAECFIAAGDAS'
                ),
            )

        self.adapter.seed_response('getTrytes', {
            'trytes': [transaction.as_tryte_string()],
        })

        response = self.command(transaction=transaction.hash)

        bundle = response['bundles'][0]  # type: Bundle
        self.assertEqual(len(bundle), 1)

        self.maxDiff = None
        self.assertDictEqual(
            bundle[0].as_json_compatible(),
            transaction.as_json_compatible(),
        )