2015-12-26 20:23:09 +00:00
|
|
|
package memorylocker
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-01-20 15:40:13 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
2019-06-11 16:23:20 +00:00
|
|
|
"github.com/tus/tusd/pkg/handler"
|
2015-12-26 20:23:09 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMemoryLocker(t *testing.T) {
|
2016-01-20 15:40:13 +00:00
|
|
|
a := assert.New(t)
|
|
|
|
|
2019-06-11 16:23:20 +00:00
|
|
|
var locker handler.LockerDataStore
|
2016-02-21 22:25:35 +00:00
|
|
|
locker = New()
|
2015-12-26 20:23:09 +00:00
|
|
|
|
2016-01-20 15:40:13 +00:00
|
|
|
a.NoError(locker.LockUpload("one"))
|
2019-06-11 16:23:20 +00:00
|
|
|
a.Equal(handler.ErrFileLocked, locker.LockUpload("one"))
|
2016-01-20 15:40:13 +00:00
|
|
|
a.NoError(locker.UnlockUpload("one"))
|
|
|
|
a.NoError(locker.UnlockUpload("one"))
|
2015-12-26 20:23:09 +00:00
|
|
|
}
|