storj/satellite/satellitedb/projects_test.go
Jeff Wendling 9da16b1d9e satellite/satellitedb/dbx: name the package dbx
everyone was importing it as dbx anyway. why should it be
named satellitedb? so yeah just pass the "-p dbx" flag.

Change-Id: I5efa669f4f00f196b38a9acd0d402009475a936f
2020-01-15 15:16:39 -07:00

38 lines
745 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package satellitedb
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"storj.io/storj/satellite/satellitedb/dbx"
)
func TestProjectFromDbx(t *testing.T) {
ctx := context.Background()
t.Run("can't create dbo from nil dbx model", func(t *testing.T) {
project, err := projectFromDBX(ctx, nil)
assert.Nil(t, project)
assert.NotNil(t, err)
assert.Error(t, err)
})
t.Run("can't create dbo from dbx model with invalid ID", func(t *testing.T) {
dbxProject := dbx.Project{
Id: []byte("qweqwe"),
}
project, err := projectFromDBX(ctx, &dbxProject)
assert.Nil(t, project)
assert.NotNil(t, err)
assert.Error(t, err)
})
}