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.
2017-04-04 07:46:09 +02:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestProductExists(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
2017-04-04 08:18:58 +02:00
|
|
|
|
2017-04-04 19:28:46 +02:00
|
|
|
ok, err := (&Product{ID: 3}).Exists()
|
2017-04-04 08:18:58 +02:00
|
|
|
assert.True(ok)
|
|
|
|
assert.NoError(err)
|
2017-04-04 07:46:09 +02:00
|
|
|
|
2017-04-04 08:18:58 +02:00
|
|
|
// test cache
|
2017-04-04 19:28:46 +02:00
|
|
|
ok, err = (&Product{ID: 3}).Exists()
|
2017-04-04 07:46:09 +02:00
|
|
|
assert.True(ok)
|
|
|
|
assert.NoError(err)
|
2017-04-04 08:18:58 +02:00
|
|
|
|
|
|
|
// WARNING: test cache after 5min skipped
|
2017-04-04 07:46:09 +02:00
|
|
|
}
|