@@ -4,16 +4,10 @@ import (
44 "testing"
55
66 app_ "github.com/ovrclk/akash/app"
7- dapp_ "github.com/ovrclk/akash/app/deployment"
8- fapp_ "github.com/ovrclk/akash/app/fulfillment"
9- lapp_ "github.com/ovrclk/akash/app/lease"
10- oapp_ "github.com/ovrclk/akash/app/order"
11- papp_ "github.com/ovrclk/akash/app/provider"
127 "github.com/ovrclk/akash/testutil"
138 "github.com/ovrclk/akash/txutil"
149 "github.com/ovrclk/akash/types"
1510 "github.com/ovrclk/akash/types/code"
16- "github.com/stretchr/testify/assert"
1711 "github.com/stretchr/testify/require"
1812 abci_types "github.com/tendermint/tendermint/abci/types"
1913)
@@ -96,80 +90,3 @@ func TestApp(t *testing.T) {
9690 }
9791
9892}
99-
100- func TestLeaseTransfer (t * testing.T ) {
101- const (
102- price = 10
103- balance = 100000
104- )
105- nonce := uint64 (1 )
106-
107- _ , keyfrom := testutil .PrivateKeySigner (t )
108- addrfrom := keyfrom .PubKey ().Address ().Bytes ()
109-
110- keyto := testutil .PrivateKey (t )
111- addrto := keyto .PubKey ().Address ().Bytes ()
112-
113- commitState , cacheState := testutil .NewState (t , & types.Genesis {
114- Accounts : []types.Account {
115- {Address : addrfrom , Balance : balance , Nonce : nonce },
116- {Address : addrto , Balance : 0 , Nonce : nonce },
117- },
118- })
119-
120- tacct , err := cacheState .Account ().Get (addrfrom )
121- require .NoError (t , err )
122-
123- pacct , err := cacheState .Account ().Get (addrto )
124- require .NoError (t , err )
125-
126- nonce ++
127-
128- app , err := app_ .Create (commitState , cacheState , testutil .Logger ())
129- require .NoError (t , err )
130-
131- dapp := app .App (dapp_ .Name )
132- require .NotNil (t , dapp )
133-
134- oapp := app .App (oapp_ .Name )
135- require .NotNil (t , oapp )
136-
137- lapp := app .App (lapp_ .Name )
138- require .NotNil (t , lapp )
139-
140- papp := app .App (papp_ .Name )
141- require .NotNil (t , papp )
142-
143- fapp := app .App (fapp_ .Name )
144- require .NotNil (t , fapp )
145-
146- provider := testutil .CreateProvider (t , cacheState , papp , pacct , keyto , nonce )
147-
148- deployment , groups := testutil .CreateDeployment (t , cacheState , dapp , tacct , keyfrom , nonce )
149- group := groups .Items [0 ]
150-
151- order := testutil .CreateOrder (t , cacheState , oapp , tacct , keyfrom , deployment .Address , group .Seq , group .Seq )
152- testutil .CreateFulfillment (t , cacheState , fapp , provider .Address , keyto , deployment .Address , group .Seq , order .Seq , price )
153- lease := testutil .CreateLease (t , cacheState , lapp , provider .Address , keyto , deployment .Address , group .Seq , order .Seq , price )
154-
155- app .Commit ()
156-
157- pacct , err = commitState .Account ().Get (addrto )
158- require .NoError (t , err )
159- assert .Equal (t , uint64 (lease .Price ), pacct .Balance )
160-
161- tacct , err = commitState .Account ().Get (addrfrom )
162- require .NoError (t , err )
163- assert .Equal (t , uint64 (balance - lease .Price ), tacct .Balance )
164-
165- app .Commit ()
166-
167- pacct , err = commitState .Account ().Get (addrto )
168- require .NoError (t , err )
169- assert .Equal (t , uint64 (lease .Price )* 2 , pacct .Balance )
170-
171- tacct , err = commitState .Account ().Get (addrfrom )
172- require .NoError (t , err )
173- assert .Equal (t , uint64 (balance - lease .Price * 2 ), tacct .Balance )
174-
175- }
0 commit comments