-
Notifications
You must be signed in to change notification settings - Fork 17
/
delete_test.go
49 lines (37 loc) · 1021 Bytes
/
delete_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package crud_test
import (
"testing"
"github.com/stretchr/testify/assert"
)
/*func TestDelete(t *testing.T) {
assert.Nil(t, CreateUserProfiles())
nova := UserProfile{}
err := DB.Read(&nova, "SELECT * FROM user_profile WHERE name = 'Nova'")
assert.Nil(t, err)
assert.Nil(t, DB.Delete(nova))
novac := UserProfile{}
err = DB.Read(&novac, "SELECT * FROM user_profile WHERE name = 'Nova'")
assert.NotNil(t, err)
}
func TestDeleteNotMatching(t *testing.T) {
assert.Nil(t, DB.Delete(&UserProfile{
Id: 123,
Name: "Yolo",
}))
}*/
func TestMustDelete(t *testing.T) {
assert.Nil(t, CreateUserProfiles())
nova := UserProfile{}
err := DB.Read(&nova, "SELECT * FROM user_profiles WHERE name = 'Nova'")
assert.Nil(t, err)
assert.Nil(t, DB.Delete(nova))
novac := UserProfile{}
err = DB.Read(&novac, "SELECT * FROM user_profiles WHERE name = 'Nova'")
assert.NotNil(t, err)
}
func TestMustDeleteNotMatching(t *testing.T) {
assert.NotNil(t, DB.Delete(&UserProfile{
Id: 123,
Name: "Yolo",
}))
}