4815cfc09b
github issue: https://github.com/storj/storj/issues/4861 Change-Id: Ia83635c0de751a77cd5a49d641da19ed76132c46
37 lines
883 B
Go
37 lines
883 B
Go
// Copyright (C) 2019 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package satellitedb_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"storj.io/common/testcontext"
|
|
"storj.io/storj/satellite"
|
|
"storj.io/storj/satellite/console"
|
|
"storj.io/storj/satellite/satellitedb/satellitedbtest"
|
|
)
|
|
|
|
func TestProjectsGetByPublicID(t *testing.T) {
|
|
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
|
|
projects := db.Console().Projects()
|
|
|
|
prj, err := projects.Insert(ctx, &console.Project{
|
|
Name: "ProjectName",
|
|
Description: "projects description",
|
|
})
|
|
require.NoError(t, err)
|
|
require.NotNil(t, prj)
|
|
|
|
pubID := prj.PublicID
|
|
require.NotNil(t, pubID)
|
|
require.False(t, pubID.IsZero())
|
|
|
|
prj, err = projects.GetByPublicID(ctx, pubID)
|
|
require.NoError(t, err)
|
|
require.Equal(t, pubID, prj.PublicID)
|
|
})
|
|
}
|