Returned StarCityGames support
This commit is contained in:
parent
de1187b96c
commit
7c6a6176dc
12 changed files with 133 additions and 72 deletions
|
|
@ -1,36 +0,0 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"github.com/flygrounder/go-mtg-vk/caching"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGetSet(t *testing.T) {
|
||||
client := getTestClient()
|
||||
keyName := "test_key"
|
||||
value := "test_value"
|
||||
client.Set(keyName, value)
|
||||
val, err := client.Get(keyName)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, value, val)
|
||||
}
|
||||
|
||||
func TestExpiration(t *testing.T) {
|
||||
client := getTestClient()
|
||||
client.Expiration = time.Millisecond
|
||||
keyName := "test_key"
|
||||
value := "test_value"
|
||||
client.Set(keyName, value)
|
||||
time.Sleep(time.Millisecond * 2)
|
||||
val, err := client.Get(keyName)
|
||||
assert.Zero(t, val)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func getTestClient() *caching.CacheClient {
|
||||
client := new(caching.CacheClient)
|
||||
client.Init()
|
||||
return client
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue