storj/satellite/satellitedb/utils_test.go
Yehor Butko e38cf8f50d
Renaming and moving pkg/satellite to satellite/console (#1054)
* [WIP] V3-853 Merge the satellite DB into the master database

* Removing consoleDB from satelliteDB

* Fixing tests for satellite/console

* fixing linter

* sorting imports in satellite/console

* fixing console config

* fixing linter
2019-01-15 15:03:24 +02:00

33 lines
620 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information.
package satellitedb
import (
"testing"
"github.com/skyrings/skyring-common/tools/uuid"
"github.com/stretchr/testify/assert"
)
func TestBytesToUUID(t *testing.T) {
t.Run("Invalid input", func(t *testing.T) {
str := "not UUID string"
bytes := []byte(str)
_, err := bytesToUUID(bytes)
assert.NotNil(t, err)
assert.Error(t, err)
})
t.Run("Valid input", func(t *testing.T) {
id, err := uuid.New()
assert.NoError(t, err)
result, err := bytesToUUID(id[:])
assert.NoError(t, err)
assert.Equal(t, result, *id)
})
}