MCPcopy
hub / github.com/tinode/chat / TestUserCreate

Function TestUserCreate

server/db/mysql/tests/mysql_test.go:59–77  ·  view source on GitHub ↗

================== Create tests ================================

(t *testing.T)

Source from the content-addressed store, hash-verified

57
58// ================== Create tests ================================
59func TestUserCreate(t *testing.T) {
60 for _, user := range testData.Users {
61 if err := adp.UserCreate(user); err != nil {
62 t.Error(err)
63 }
64 }
65 var count int
66
67 if err := db.Ping(); err != nil {
68 logs.Err.Println("Database ping failed:", err)
69 }
70 err := db.QueryRow("SELECT COUNT(*) FROM users").Scan(&count)
71 if err != nil {
72 t.Error(err)
73 }
74 if count == 0 {
75 t.Error("No users created!")
76 }
77}
78
79func TestCredUpsert(t *testing.T) {
80 // Test just inserts:

Callers

nothing calls this directly

Calls 5

ErrorMethod · 0.80
PingMethod · 0.80
PrintlnMethod · 0.80
UserCreateMethod · 0.65
ScanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…