@@ -30,12 +30,12 @@ func TestMain(m *testing.M) {
3030
3131func TestClient_AccountFund (t * testing.T ) {
3232 d := NewClient ("" )
33- accounts , err := d .AccountList ()
33+ accounts , err := d .AccountList (1 , 20 )
3434 if err != nil {
3535 t .Error (err )
3636 return
3737 }
38- account := (accounts .LBCRegtest )[0 ].ID
38+ account := (accounts .Items )[0 ].ID
3939 balanceString , err := d .AccountBalance (& account )
4040 if err != nil {
4141 t .Error (err )
@@ -56,7 +56,7 @@ func TestClient_AccountFund(t *testing.T) {
5656
5757func TestClient_AccountList (t * testing.T ) {
5858 d := NewClient ("" )
59- got , err := d .AccountList ()
59+ got , err := d .AccountList (1 , 20 )
6060 if err != nil {
6161 t .Error (err )
6262 return
@@ -72,13 +72,16 @@ func TestClient_SingleAccountList(t *testing.T) {
7272 t .Fatal (err )
7373 }
7474 account , err := d .SingleAccountList (createdAccount .ID )
75+ if err != nil {
76+ t .Error (err )
77+ }
7578 prettyPrint (* createdAccount )
7679 prettyPrint (* account )
7780 if err != nil {
7881 t .Fatal (err )
7982 }
80- if account .Name != name {
81- t .Fatalf ("account name mismatch: %v != %v" , account .Name , name )
83+ if account .Items [ 0 ]. Name != name {
84+ t .Fatalf ("account name mismatch: %v != %v" , account .Items [ 0 ]. Name , name )
8285 }
8386}
8487
@@ -116,7 +119,7 @@ var channelID string
116119
117120func TestClient_ChannelCreate (t * testing.T ) {
118121 d := NewClient ("" )
119- got , err := d .ChannelCreate ("@Test" + fmt .Sprintf ("%d" , time .Now ().Unix ()), 13.37 , ChannelCreateOptions {
122+ got , err := d .ChannelCreate ("@Test" + fmt .Sprintf ("%d" , time .Now ().Unix ()), 1.337 , ChannelCreateOptions {
120123 ClaimCreateOptions : ClaimCreateOptions {
121124 Title : util .PtrToString ("Mess with the channels" ),
122125 Description : util .PtrToString ("And you'll get what you deserve" ),
@@ -150,7 +153,14 @@ func TestClient_StreamCreate(t *testing.T) {
150153 return
151154 }
152155 address := string (* addressResponse )
153- got , err := d .StreamCreate ("test" + fmt .Sprintf ("%d" , time .Now ().Unix ()), "/home/niko/Downloads/IMG_20171012_205120.jpg" , 14.37 , StreamCreateOptions {
156+ f , e := os .OpenFile ("/tmp/test.txt" , os .O_RDONLY | os .O_CREATE , 0666 )
157+ if e != nil {
158+ t .Error (e )
159+ return
160+ }
161+
162+ _ , _ = f .WriteString ("test" )
163+ got , err := d .StreamCreate ("test" + fmt .Sprintf ("%d" , time .Now ().Unix ()), "/tmp/test.txt" , 1.437 , StreamCreateOptions {
154164 ClaimCreateOptions : ClaimCreateOptions {
155165 Title : util .PtrToString ("This is a Test Title" + fmt .Sprintf ("%d" , time .Now ().Unix ())),
156166 Description : util .PtrToString ("My Special Description" ),
@@ -261,7 +271,7 @@ func TestClient_ChannelAbandon(t *testing.T) {
261271
262272func TestClient_AddressList (t * testing.T ) {
263273 d := NewClient ("" )
264- got , err := d .AddressList (nil , nil )
274+ got , err := d .AddressList (nil , nil , 1 , 20 )
265275 if err != nil {
266276 t .Error (err )
267277 return
@@ -283,7 +293,7 @@ func TestClient_ClaimList(t *testing.T) {
283293func TestClient_StreamList (t * testing.T ) {
284294 _ = os .Setenv ("BLOCKCHAIN_NAME" , "lbrycrd_regtest" )
285295 d := NewClient ("" )
286- got , err := d .StreamList (nil )
296+ got , err := d .StreamList (nil , 1 , 20 )
287297 if err != nil {
288298 t .Error (err )
289299 return
@@ -294,7 +304,7 @@ func TestClient_StreamList(t *testing.T) {
294304func TestClient_TransactionList (t * testing.T ) {
295305 _ = os .Setenv ("BLOCKCHAIN_NAME" , "lbrycrd_regtest" )
296306 d := NewClient ("" )
297- got , err := d .TransactionList (nil )
307+ got , err := d .TransactionList (nil , 1 , 20 )
298308 if err != nil {
299309 t .Error (err )
300310 return
@@ -327,7 +337,7 @@ func TestClient_SupportTest(t *testing.T) {
327337 return
328338 }
329339 time .Sleep (10 * time .Second )
330- got2 , err := d .SupportCreate (got .Outputs [0 ].ClaimID , "1.0" , util .PtrToBool (true ), nil , nil )
340+ got2 , err := d .SupportCreate (got .Outputs [0 ].ClaimID , "1.0" , util .PtrToBool (true ), nil , nil , nil )
331341 if err != nil {
332342 t .Error (err )
333343 return
@@ -360,7 +370,7 @@ func TestClient_SupportTest(t *testing.T) {
360370
361371func TestClient_ClaimSearch (t * testing.T ) {
362372 d := NewClient ("" )
363- got , err := d .ClaimSearch (nil , util .PtrToString (channelID ), nil , nil )
373+ got , err := d .ClaimSearch (nil , util .PtrToString (channelID ), nil , nil , 1 , 20 )
364374 if err != nil {
365375 t .Error (err )
366376 return
@@ -380,7 +390,7 @@ func TestClient_Status(t *testing.T) {
380390
381391func TestClient_UTXOList (t * testing.T ) {
382392 d := NewClient ("" )
383- got , err := d .UTXOList (nil )
393+ got , err := d .UTXOList (nil , 1 , 20 )
384394 if err != nil {
385395 t .Error (err )
386396 return
@@ -412,7 +422,7 @@ func TestClient_GetFile(t *testing.T) {
412422func TestClient_FileList (t * testing.T ) {
413423 _ = os .Setenv ("BLOCKCHAIN_NAME" , "lbrycrd_regtest" )
414424 d := NewClient ("" )
415- got , err := d .FileList ()
425+ got , err := d .FileList (1 , 20 )
416426 if err != nil {
417427 t .Error (err )
418428 return
@@ -428,21 +438,17 @@ func TestClient_Resolve(t *testing.T) {
428438 t .Error (err )
429439 return
430440 }
431- if err != nil {
432- t .Error (err )
433- return
434- }
435441 prettyPrint (* got )
436442}
437443
438444func TestClient_AccountSet (t * testing.T ) {
439445 d := NewClient ("" )
440- accounts , err := d .AccountList ()
446+ accounts , err := d .AccountList (1 , 20 )
441447 if err != nil {
442448 t .Error (err )
443449 return
444450 }
445- account := (accounts .LBCRegtest )[0 ].ID
451+ account := (accounts .Items )[0 ].ID
446452
447453 got , err := d .AccountSet (account , AccountSettings {ChangeMaxUses : util .PtrToInt (10000 )})
448454 if err != nil {
@@ -506,7 +512,7 @@ func TestClient_AccountRemove(t *testing.T) {
506512
507513 account , err := d .SingleAccountList (createdAccount .ID )
508514 if err != nil {
509- if strings .HasPrefix (err .Error (), "Error in daemon: Couldn't find account" ) {
515+ if strings .Contains (err .Error (), "Couldn't find account: " ) {
510516 prettyPrint (* removedAccount )
511517 return
512518 }
@@ -550,6 +556,9 @@ func TestClient_ChannelImport(t *testing.T) {
550556 t .Error (err )
551557 }
552558 channels , err := d .ChannelList (nil , 1 , 50 , nil )
559+ if err != nil {
560+ t .Error (err )
561+ }
553562 seen := false
554563 for _ , c := range channels .Items {
555564 if c .Name == channelName {
@@ -567,10 +576,12 @@ func TestClient_ChannelImportWithWalletID(t *testing.T) {
567576
568577 id := "lbry#wallet#id:" + fmt .Sprintf ("%d" , rand .Int ())
569578 wallet , err := d .WalletCreate (id , nil )
570-
579+ if err != nil {
580+ t .Error (err )
581+ }
571582 // A channel created just for automated testing purposes
572583 channelName := "@LbryAutomatedTestChannel"
573- channelkey := "7943FWPBHZES4dUcMXSpDYwoM5a2tsyJT1R8V54QoUhekGcqmeH3hbzDXoLLQ8" +
584+ channelKey := "7943FWPBHZES4dUcMXSpDYwoM5a2tsyJT1R8V54QoUhekGcqmeH3hbzDXoLLQ8" +
574585 "oKkfb99PgGK5efrZeYqaxg4X5XRJMJ6gKC8hqKcnwhYkmKDXmoBDNgd2ccZ9jhP8z" +
575586 "HG3NJorAN9Hh4XMyBc5goBLZYYvC9MYvBmT3Fcteb5saqMvmQxFURv74NqXLQZC1t" +
576587 "p6iRZKfTj77Pd5gsBsCYAbVmCqzbm5m1hHkUmfFEZVGcQNTYCDwZn543xSMYvSPnJ" +
@@ -582,11 +593,14 @@ func TestClient_ChannelImportWithWalletID(t *testing.T) {
582593 "hxsFwGUyNNno8eiqrrYmpbJGEwwK3S4437JboAUEFPdMNn8zNQWZcLLVrK9KyQeKM" +
583594 "XpKkf4zJV6sZJ7gBMpzvPL18ULEgXTy7VsNBKmsfC1rM4WVG9ri1UixEcLDS79foC" +
584595 "Jb3FnSr1T4MRKESeN3W"
585- response , err := d .ChannelImport (channelkey , & wallet .ID )
596+ response , err := d .ChannelImport (channelKey , & wallet .ID )
586597 if err != nil {
587598 t .Error (err )
588599 }
589600 channels , err := d .ChannelList (nil , 1 , 50 , & wallet .ID )
601+ if err != nil {
602+ t .Error (err )
603+ }
590604 seen := false
591605 for _ , c := range channels .Items {
592606 if c .Name == channelName {
@@ -627,7 +641,7 @@ func TestClient_WalletCreateWithOpts(t *testing.T) {
627641 }
628642 prettyPrint (wallet )
629643 prettyPrint (accounts )
630- if accounts .LBCMainnet [0 ].Name == "" {
644+ if accounts .Items [0 ].Name == "" {
631645 t .Fatalf ("account name is empty" )
632646 }
633647}
@@ -636,7 +650,7 @@ func TestClient_WalletList(t *testing.T) {
636650 d := NewClient ("" )
637651
638652 id := "lbry#wallet#id:" + fmt .Sprintf ("%d" , rand .Int ())
639- wList , err := d .WalletList (id )
653+ wList , err := d .WalletList (id , 1 , 20 )
640654 if err == nil {
641655 t .Fatalf ("wallet %v was unexpectedly found" , id )
642656 }
@@ -649,15 +663,15 @@ func TestClient_WalletList(t *testing.T) {
649663 t .Fatal (err )
650664 }
651665
652- wList , err = d .WalletList (id )
666+ wList , err = d .WalletList (id , 1 , 20 )
653667 if err != nil {
654668 t .Fatal (err )
655669 }
656- if len (* wList ) < 1 {
670+ if len (wList . Items ) < 1 {
657671 t .Fatal ("wallet list is empty" )
658672 }
659- if (* wList )[0 ].ID != id {
660- t .Fatalf ("wallet ID mismatch, expected %q, got %q" , id , (* wList )[0 ].ID )
673+ if (wList . Items )[0 ].ID != id {
674+ t .Fatalf ("wallet ID mismatch, expected %q, got %q" , id , (wList . Items )[0 ].ID )
661675 }
662676}
663677
0 commit comments