Example #1
1
func init() {
	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file,
		".."+string(filepath.Separator))))
	beego.TestBeegoInit(apppath)
	beego.SetLevel(logs.LevelInfo)
}
Example #2
0
func init() {
	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
	beego.TestBeegoInit(apppath)
	initORM()
	// switch to prod
	beego.BConfig.RunMode = "prod"
}
Example #3
0
func init() {
	//orm.RegisterDriver("sqlite3", orm.DRSqlite)
	orm.RegisterDataBase("default", "sqlite3", "../db/persistence.db")
	//orm.RegisterModel(new(models.ClusterInfo), new(models.Storage)) //move in model init()

	dbdrop()
	dbcreate()
	clearDB()
	dataInsert()

	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
	beego.TestBeegoInit(apppath)

}
Example #4
0
func init() {
	dao.InitDatabase()
	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.TestBeegoInit(apppath)

	beego.Router("/api/search/", &SearchAPI{})
	beego.Router("/api/projects/", &ProjectAPI{}, "get:List;post:Post;head:Head")
	beego.Router("/api/projects/:id", &ProjectAPI{}, "delete:Delete;get:Get")
	beego.Router("/api/users/?:id", &UserAPI{})
	beego.Router("/api/users/:id([0-9]+)/password", &UserAPI{}, "put:ChangePassword")
	beego.Router("/api/users/:id/sysadmin", &UserAPI{}, "put:ToggleUserAdminRole")
	beego.Router("/api/projects/:id/publicity", &ProjectAPI{}, "put:ToggleProjectPublic")
	beego.Router("/api/projects/:id([0-9]+)/logs/filter", &ProjectAPI{}, "post:FilterAccessLog")
	beego.Router("/api/projects/:pid([0-9]+)/members/?:mid", &ProjectMemberAPI{}, "get:Get;post:Post;delete:Delete;put:Put")
	beego.Router("/api/statistics", &StatisticAPI{})
	beego.Router("/api/users/?:id", &UserAPI{})
	beego.Router("/api/logs", &LogAPI{})
	beego.Router("/api/repositories", &RepositoryAPI{})
	beego.Router("/api/repositories/tags", &RepositoryAPI{}, "get:GetTags")
	beego.Router("/api/repositories/manifests", &RepositoryAPI{}, "get:GetManifests")
	beego.Router("/api/repositories/top", &RepositoryAPI{}, "get:GetTopRepos")
	beego.Router("/api/targets/", &TargetAPI{}, "get:List")
	beego.Router("/api/targets/", &TargetAPI{}, "post:Post")
	beego.Router("/api/targets/:id([0-9]+)", &TargetAPI{})
	beego.Router("/api/targets/:id([0-9]+)/policies/", &TargetAPI{}, "get:ListPolicies")
	beego.Router("/api/targets/ping", &TargetAPI{}, "post:Ping")
	beego.Router("/api/policies/replication/:id([0-9]+)", &RepPolicyAPI{})
	beego.Router("/api/policies/replication", &RepPolicyAPI{}, "get:List")
	beego.Router("/api/policies/replication", &RepPolicyAPI{}, "post:Post;delete:Delete")
	beego.Router("/api/policies/replication/:id([0-9]+)/enablement", &RepPolicyAPI{}, "put:UpdateEnablement")

	_ = updateInitPassword(1, "Harbor12345")

	//syncRegistry
	if err := SyncRegistry(); err != nil {
		log.Fatalf("failed to sync repositories from registry: %v", err)
	}

	//Init user Info
	admin = &usrInfo{adminName, adminPwd}
	unknownUsr = &usrInfo{"unknown", "unknown"}
	testUser = &usrInfo{TestUserName, TestUserPwd}

}
Example #5
0
func init() {

	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
	beego.BConfig.WebConfig.Session.SessionOn = true
	beego.TestBeegoInit(apppath)
	beego.AddTemplateExt("htm")

	beego.Router("/", &IndexController{})
	beego.Router("/dashboard", &DashboardController{})
	beego.Router("/project", &ProjectController{})
	beego.Router("/repository", &RepositoryController{})
	beego.Router("/sign_up", &SignUpController{})
	beego.Router("/add_new", &AddNewController{})
	beego.Router("/account_setting", &AccountSettingController{})
	beego.Router("/change_password", &ChangePasswordController{})
	beego.Router("/admin_option", &AdminOptionController{})
	beego.Router("/forgot_password", &ForgotPasswordController{})
	beego.Router("/reset_password", &ResetPasswordController{})
	beego.Router("/search", &SearchController{})

	beego.Router("/login", &CommonController{}, "post:Login")
	beego.Router("/log_out", &CommonController{}, "get:LogOut")
	beego.Router("/reset", &CommonController{}, "post:ResetPassword")
	beego.Router("/userExists", &CommonController{}, "post:UserExists")
	beego.Router("/sendEmail", &CommonController{}, "get:SendEmail")
	beego.Router("/language", &CommonController{}, "get:SwitchLanguage")

	beego.Router("/optional_menu", &OptionalMenuController{})
	beego.Router("/navigation_header", &NavigationHeaderController{})
	beego.Router("/navigation_detail", &NavigationDetailController{})
	beego.Router("/sign_in", &SignInController{})

	//Init user Info
	//admin = &usrInfo{adminName, adminPwd}

}
Example #6
0
func init() {
	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+filepath.Separator)))
	beego.TestBeegoInit(apppath)
}
Example #7
0
func init() {
	_, file, _, _ := runtime.Caller(1)
	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
	beego.TestBeegoInit(apppath)
	models.RegistDB()
}
Example #8
0
package test