storj/satellite/satellitedb/users_test.go
Yehor Butko 8156d911fa
Updating account activation flow (#1251)
* Updating account activation flow

* Updated integration tests, createUserMutation updated

* removing redundant index

* removed redundant testing code

* review comments fixed
2019-02-11 12:33:56 +02:00

38 lines
810 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package satellitedb
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
dbx "storj.io/storj/satellite/satellitedb/dbx"
)
func TestUserFromDbx(t *testing.T) {
t.Run("can't create dbo from nil dbx model", func(t *testing.T) {
user, err := userFromDBX(nil)
assert.Nil(t, user)
assert.Error(t, err)
})
t.Run("can't create dbo from dbx model with invalid ID", func(t *testing.T) {
dbxUser := dbx.User{
Id: []byte("qweqwe"),
FirstName: "FirstName",
LastName: "LastName",
Email: "some@email.com",
PasswordHash: []byte("ihqerfgnu238723huagsd"),
CreatedAt: time.Now(),
}
user, err := userFromDBX(&dbxUser)
assert.Nil(t, user)
assert.Error(t, err)
})
}