Created
March 17, 2015 13:47
-
-
Save maksadbek/747b32eca9f9a608273a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package datastore | |
import ( | |
"fmt" | |
"testing" | |
) | |
func TestGetStaffFromCache(t *testing.T) { | |
staff := Staff{Id: 1000} | |
err := GetFromList(&staff) | |
if err != nil { | |
t.Error(err) | |
} | |
fmt.Printf("%+v\n", staff) | |
} | |
//OUTPUT | |
/* | |
=== RUN TestGetStaffFromCache | |
{Id:1000 Login: Password: Name:drinks Role:Role(0) CreatedAt:0001-01-01 00:00:00 +0000 UTC UpdatedAt:0001-01-01 00:00:00 +0000 UTC Identity:} | |
--- PASS: TestGetStaffFromCache (0.00s) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// categories for test Data | |
// create categories | |
var catData = []Cat{ | |
Cat{ | |
Id: 1000, | |
Name: "drinks", | |
Desc: "various drinks", | |
Base: Base{ | |
StaffId: 1000, | |
Staff: staffData[0], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
Cat{ | |
Id: 1001, | |
Name: "alcohol", | |
Desc: "alcohol drinks", | |
Base: Base{ | |
StaffId: 1001, | |
Staff: staffData[1], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
Cat{ | |
Id: 1002, | |
Name: "elite alcohol", | |
Desc: "elite, expensive alcohol drinks", | |
Base: Base{ | |
StaffId: 1002, | |
Staff: staffData[2], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
Cat{ | |
Id: 1003, | |
Name: "First meal", | |
Desc: "first meal ", | |
Base: Base{ | |
StaffId: 1003, | |
Staff: staffData[3], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
Cat{ | |
Id: 1004, | |
Name: "Second meal", | |
Desc: "second meal ", | |
Base: Base{ | |
StaffId: 1004, | |
Staff: staffData[4], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
Cat{ | |
Id: 1005, | |
Name: "Kebabs", | |
Desc: "kebabs from fresh meat", | |
Base: Base{ | |
StaffId: 1003, | |
Staff: staffData[3], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
Cat{ | |
Id: 1006, | |
Name: "Fast Food", | |
Desc: "quick food for fat asses", | |
Base: Base{ | |
StaffId: 1002, | |
Staff: staffData[2], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
Cat{ | |
Id: 1007, | |
Name: "Salads", | |
Desc: "fresh salads", | |
Base: Base{ | |
StaffId: 1001, | |
Staff: staffData[1], | |
CreatedAt: time.Now(), | |
UpdatedAt: time.Now(), | |
}, | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment