testutils

package
v1.0.51 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2023 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-or-later DMRHub - Run a DMR network server in a single binary Copyright (C) 2023 Jacob McSwain

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

The source code is available at <https://github.com/USA-RedDragon/DMRHub>

Index

Constants

View Source
const RedisImageName = "redis"
View Source
const RedisTag = "7-alpine"

Variables

This section is empty.

Functions

func CreateAndLoginUser added in v1.0.15

func CreateAndLoginUser(t *testing.T, router *gin.Engine, user apimodels.UserRegistration) (APIResponse, *httptest.ResponseRecorder, CookieJar)

func GetUser added in v1.0.15

func GetUser(t *testing.T, router *gin.Engine, dmrID uint, jar CookieJar) (models.User, *httptest.ResponseRecorder)

func GetUserMe added in v1.0.15

func GetUserMe(t *testing.T, router *gin.Engine, jar CookieJar) (models.User, *httptest.ResponseRecorder)

func LoginAdmin added in v1.0.15

func LoginAdmin(t *testing.T, router *gin.Engine) (APIResponse, *httptest.ResponseRecorder, CookieJar)

func LoginUser added in v1.0.15

Types

type APIResponse

type APIResponse struct {
	Message string `json:"message"`
	Error   string `json:"error"`
}

func ApproveUser added in v1.0.15

func ApproveUser(t *testing.T, router *gin.Engine, dmrID uint, jar CookieJar) (APIResponse, *httptest.ResponseRecorder)

func DeleteUser added in v1.0.15

func DeleteUser(t *testing.T, router *gin.Engine, dmrID uint, jar CookieJar) (APIResponse, *httptest.ResponseRecorder)

func DemoteUser added in v1.0.15

func DemoteUser(t *testing.T, router *gin.Engine, dmrID uint, jar CookieJar) (APIResponse, *httptest.ResponseRecorder)

func LogoutUser added in v1.0.15

func LogoutUser(t *testing.T, router *gin.Engine, jar CookieJar) (APIResponse, *httptest.ResponseRecorder)

func PromoteUser added in v1.0.15

func PromoteUser(t *testing.T, router *gin.Engine, dmrID uint, jar CookieJar) (APIResponse, *httptest.ResponseRecorder)

func RegisterUser added in v1.0.15

func SuspendUser added in v1.0.15

func SuspendUser(t *testing.T, router *gin.Engine, dmrID uint, jar CookieJar) (APIResponse, *httptest.ResponseRecorder)

func UnsuspendUser added in v1.0.15

func UnsuspendUser(t *testing.T, router *gin.Engine, dmrID uint, jar CookieJar) (APIResponse, *httptest.ResponseRecorder)

type APIResponseUserList added in v1.0.15

type APIResponseUserList struct {
	Total int           `json:"total"`
	Users []models.User `json:"users"`
}

func ListUsers added in v1.0.15

func ListUsers(t *testing.T, router *gin.Engine, jar CookieJar) (APIResponseUserList, *httptest.ResponseRecorder)

type CookieJar added in v1.0.15

type CookieJar struct {
	// contains filtered or unexported fields
}

func (*CookieJar) Cookies added in v1.0.15

func (t *CookieJar) Cookies() []http.Cookie

func (*CookieJar) SetCookies added in v1.0.15

func (t *CookieJar) SetCookies(cookies []http.Cookie)

type TestDB

type TestDB struct {
	// contains filtered or unexported fields
}

func CreateTestDBRouter

func CreateTestDBRouter() (*gin.Engine, *TestDB)

func (*TestDB) CloseDB

func (t *TestDB) CloseDB()

func (*TestDB) CloseRedis

func (t *TestDB) CloseRedis()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL