genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
hs_monolith/models/good_test.go

37 lines
722 B
Go
Raw Normal View History

2017-05-03 07:30:18 +02:00
// Package with the mostly static content (models) of this microservice
package models
import (
"testing"
"github.com/genofire/hs_master-kss-monolith/lib/database"
"github.com/stretchr/testify/assert"
)
2017-05-03 07:30:18 +02:00
// Function to test the locking and unlocking of a good
func TestGood(t *testing.T) {
assert := assert.New(t)
database.Open(database.Config{
Type: "sqlite3",
Logging: true,
Connection: ":memory:",
})
good := &Good{}
assert.False(good.IsLock())
good.Lock("blub_secret")
assert.True(good.IsLock())
err := good.Unlock("secret")
assert.Error(err)
assert.True(good.IsLock())
good.Unlock("blub_secret")
assert.False(good.IsLock())
assert.NotNil(good.FilterAvailable(database.Read))
}