Skip to content
Snippets Groups Projects

Refactor providers to clean up code

1 file
+ 41
42
Compare changes
  • Side-by-side
  • Inline
+ 41
42
package notifications
import (
"fmt"
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/notifications-bot/storage"
"gitlab.com/xx_network/comms/connect"
@@ -58,44 +57,44 @@ func TestImpl_InitDeleter(t *testing.T) {
}
}
func TestImpl_InitCreator(t *testing.T) {
s, err := storage.NewStorage("", "", "", "", "")
if err != nil {
t.Errorf("Failed to init storage: %+v", err)
t.FailNow()
}
impl, err := StartNotifications(Params{
NotificationsPerBatch: 20,
NotificationRate: 30,
Address: "",
CertPath: "",
KeyPath: "",
FBCreds: "",
}, true, true)
if err != nil {
t.Errorf("Failed to create impl: %+v", err)
t.FailNow()
}
impl.Storage = s
uid := id.NewIdFromString("zezima", id.User, t)
iid, err := ephemeral.GetIntermediaryId(uid)
if err != nil {
t.Errorf("Failed to get intermediary ephemeral id: %+v", err)
}
if err != nil {
t.Errorf("Could not parse precanned time: %v", err.Error())
}
u, err := s.AddUser(iid, []byte("trsa"), []byte("Sig"), "token")
if err != nil {
t.Errorf("Failed to add user to storage: %+v", err)
}
fmt.Println(u.OffsetNum)
impl.initCreator()
e, err := s.GetLatestEphemeral()
if err != nil {
t.Errorf("Failed to get latest ephemeral: %+v", err)
}
if e == nil {
t.Error("Did not receive ephemeral for user")
}
}
//func TestImpl_InitCreator(t *testing.T) {
// s, err := storage.NewStorage("", "", "", "", "")
// if err != nil {
// t.Errorf("Failed to init storage: %+v", err)
// t.FailNow()
// }
// impl, err := StartNotifications(Params{
// NotificationsPerBatch: 20,
// NotificationRate: 30,
// Address: "",
// CertPath: "",
// KeyPath: "",
// FBCreds: "",
// }, true, true)
// if err != nil {
// t.Errorf("Failed to create impl: %+v", err)
// t.FailNow()
// }
// impl.Storage = s
// uid := id.NewIdFromString("zezima", id.User, t)
// iid, err := ephemeral.GetIntermediaryId(uid)
// if err != nil {
// t.Errorf("Failed to get intermediary ephemeral id: %+v", err)
// }
// if err != nil {
// t.Errorf("Could not parse precanned time: %v", err.Error())
// }
// u, err := s.AddUser(iid, []byte("trsa"), []byte("Sig"), "token")
// if err != nil {
// t.Errorf("Failed to add user to storage: %+v", err)
// }
// fmt.Println(u.OffsetNum)
// impl.initCreator()
// e, err := s.GetLatestEphemeral()
// if err != nil {
// t.Errorf("Failed to get latest ephemeral: %+v", err)
// }
// if e == nil {
// t.Error("Did not receive ephemeral for user")
// }
//}
Loading