mirror of
https://github.com/pushbits/server.git
synced 2025-05-10 07:26:59 +02:00
improve code
This commit is contained in:
parent
72671f33d3
commit
4c84589172
2 changed files with 3 additions and 6 deletions
|
@ -178,7 +178,7 @@ func TestApi_GetApplicationErrors(t *testing.T) {
|
||||||
gin.SetMode(gin.TestMode)
|
gin.SetMode(gin.TestMode)
|
||||||
|
|
||||||
// Arbitrary test cases
|
// Arbitrary test cases
|
||||||
testCases := make(map[uint]tests.Request, 0)
|
testCases := make(map[uint]tests.Request)
|
||||||
testCases[0] = tests.Request{Name: "Requesting unknown application 0", Method: "GET", Endpoint: "/application/0", ShouldStatus: 404}
|
testCases[0] = tests.Request{Name: "Requesting unknown application 0", Method: "GET", Endpoint: "/application/0", ShouldStatus: 404}
|
||||||
testCases[5555] = tests.Request{Name: "Requesting unknown application 5555", Method: "GET", Endpoint: "/application/5555", ShouldStatus: 404}
|
testCases[5555] = tests.Request{Name: "Requesting unknown application 5555", Method: "GET", Endpoint: "/application/5555", ShouldStatus: 404}
|
||||||
testCases[99999999999999999] = tests.Request{Name: "Requesting unknown application 99999999999999999", Method: "GET", Endpoint: "/application/99999999999999999", ShouldStatus: 404}
|
testCases[99999999999999999] = tests.Request{Name: "Requesting unknown application 99999999999999999", Method: "GET", Endpoint: "/application/99999999999999999", ShouldStatus: 404}
|
||||||
|
@ -325,11 +325,7 @@ func getApplicationHandler(c *configuration.Configuration) (*ApplicationHandler,
|
||||||
// True if all created applications are in list
|
// True if all created applications are in list
|
||||||
func validateAllApplications(user *model.User, apps []model.Application) bool {
|
func validateAllApplications(user *model.User, apps []model.Application) bool {
|
||||||
if _, ok := SuccessAplications[user.ID]; !ok {
|
if _, ok := SuccessAplications[user.ID]; !ok {
|
||||||
if len(apps) == 0 {
|
return len(apps) == 0
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, successApp := range SuccessAplications[user.ID] {
|
for _, successApp := range SuccessAplications[user.ID] {
|
||||||
|
|
|
@ -20,6 +20,7 @@ type Pair struct {
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
m.Run()
|
m.Run()
|
||||||
cleanUp()
|
cleanUp()
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfiguration_GetMinimal(t *testing.T) {
|
func TestConfiguration_GetMinimal(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue