Commit 7bc05a56 authored by Ralph Pichler's avatar Ralph Pichler Committed by GitHub

call reserve in booking test correctly (#584)

parent 526dce5e
...@@ -66,7 +66,7 @@ func TestAccountingAddBalance(t *testing.T) { ...@@ -66,7 +66,7 @@ func TestAccountingAddBalance(t *testing.T) {
for i, booking := range bookings { for i, booking := range bookings {
if booking.price < 0 { if booking.price < 0 {
err = acc.Reserve(booking.peer, uint64(booking.price)) err = acc.Reserve(booking.peer, uint64(-booking.price))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
...@@ -74,6 +74,7 @@ func TestAccountingAddBalance(t *testing.T) { ...@@ -74,6 +74,7 @@ func TestAccountingAddBalance(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
acc.Release(booking.peer, uint64(-booking.price))
} else { } else {
err = acc.Debit(booking.peer, uint64(booking.price)) err = acc.Debit(booking.peer, uint64(booking.price))
if err != nil { if err != nil {
...@@ -89,10 +90,6 @@ func TestAccountingAddBalance(t *testing.T) { ...@@ -89,10 +90,6 @@ func TestAccountingAddBalance(t *testing.T) {
if balance != booking.expectedBalance { if balance != booking.expectedBalance {
t.Fatalf("balance for peer %v not as expected after booking %d. got %d, wanted %d", booking.peer.String(), i, balance, booking.expectedBalance) t.Fatalf("balance for peer %v not as expected after booking %d. got %d, wanted %d", booking.peer.String(), i, balance, booking.expectedBalance)
} }
if booking.price < 0 {
acc.Release(booking.peer, uint64(booking.price))
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment