From ef1f17346c21987b7a99866a86d4761adbc62cd3 Mon Sep 17 00:00:00 2001
From: librelois <elois@ifee.fr>
Date: Sun, 5 May 2019 00:18:30 +0200
Subject: [PATCH] [tests] blockchain-dal: now blockstamp is needed to apply tx

---
 Cargo.lock                                             |  1 +
 lib/modules/blockchain/blockchain-dal/Cargo.toml       |  3 ++-
 .../blockchain-dal/src/writers/transaction.rs          | 10 +++++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 6b9b5569..58d47cc3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -384,6 +384,7 @@ dependencies = [
  "serde 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.86 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unwrap 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
diff --git a/lib/modules/blockchain/blockchain-dal/Cargo.toml b/lib/modules/blockchain/blockchain-dal/Cargo.toml
index 55e85f90..4092ca33 100644
--- a/lib/modules/blockchain/blockchain-dal/Cargo.toml
+++ b/lib/modules/blockchain/blockchain-dal/Cargo.toml
@@ -24,8 +24,9 @@ serde_derive = "1.0.*"
 serde_json = "1.0.*"
 
 [dev-dependencies]
-rust-tests-tools = { path = "../../../tests-tools/rust-tests-tools" }
 dup-crypto-tests-tools = { path = "../../../tests-tools/crypto-tests-tools" }
 dubp-documents-tests-tools = { path = "../../../tests-tools/documents-tests-tools" }
+rust-tests-tools = { path = "../../../tests-tools/rust-tests-tools" }
+unwrap = "1.2.1"
 
 [features]
diff --git a/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs b/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs
index 6895fc83..39f6e730 100644
--- a/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs
+++ b/lib/modules/blockchain/blockchain-dal/src/writers/transaction.rs
@@ -426,6 +426,7 @@ mod tests {
     use super::*;
     use dubp_documents::{Document, DocumentBuilder, VerificationResult};
     use std::str::FromStr;
+    use unwrap::unwrap;
 
     fn build_first_tx_of_g1() -> TransactionDocument {
         let pubkey = PubKey::Ed25519(
@@ -516,7 +517,10 @@ mod tests {
             SourceAmount(TxAmount(1000), TxBase(0))
         );
         // Apply first g1 transaction
-        apply_and_write_tx(&currency_dbs, &tx_doc).expect("Fail to apply first g1 tx");
+        let blockstamp = unwrap!(Blockstamp::from_string(
+            "52-000057D4B29AF6DADB16F841F19C54C00EB244CECA9C8F2D4839D54E5F91451C"
+        ));
+        apply_and_write_tx(&blockstamp, &currency_dbs, &tx_doc).expect("Fail to apply first g1 tx");
         // Check issuer new balance
         let cgeek_new_balance = currency_dbs
             .balances_db
@@ -547,7 +551,11 @@ mod tests {
         );
 
         // Revert first g1 tx
+        let blockstamp = unwrap!(Blockstamp::from_string(
+            "52-000057D4B29AF6DADB16F841F19C54C00EB244CECA9C8F2D4839D54E5F91451C"
+        ));
         revert_tx(
+            &blockstamp,
             &currency_dbs,
             &DALTxV10 {
                 tx_doc: tx_doc.clone(),
-- 
GitLab