def test_get_transactions_with_one_valid_and_one_invalid_hash_2(self): hv = iroha.HashVector() hv.append(iroha.Hash("1")) hv.append(iroha.Hash("1" * 32)) with self.assertRaises(ValueError): self.base().getTransactions(hv).build()
def test_get_transactions(self): hv = iroha.HashVector() hv.append(iroha.Hash("1" * 32)) hv.append(iroha.Hash("2" * 32)) self.assertTrue(hv.size() == 2) query = self.builder.getTransactions(hv).build() self.assertTrue(self.check_proto_query(self.proto(query)))
def test_get_transactions_with_invalid_hash_sizes(self): hashes = ["", "1", "1" * 31, "1" * 33] for h in hashes: hv = iroha.HashVector() hv.append(iroha.Hash(h)) with self.assertRaises(ValueError): self.base().getTransactions(hv).build()
def transactions_query(): hashes = iroha.HashVector() hashes.append(alice_tx1_hash) hashes.append(iroha.Hash(iroha.Blob(alice_tx2_hash_blob))) tx = iroha.ModelQueryBuilder() \ .createdTime(commons.now()) \ .queryCounter(1) \ .creatorAccountId(alice['id']) \ .getTransactions(hashes) \ .build() return iroha.ModelProtoQuery(tx) \ .signAndAddSignature(alice['key']).finish()
def test_get_transactions(self): query = self.builder.getTransactions( [iroha.Hash("1" * 32), iroha.Hash("2" * 32)]).build() self.assertTrue(self.check_proto_query(self.proto(query)))