utils

package
v0.0.0-...-6a85f19 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Success constants
	GradesByStudent = "Successfully retrieved all the grades by student"
	AllGrades       = "Successfully retrieved all grades"
	GradeInserted   = "Successfully inserted grade with ID %s"
	GradeDeleted    = "Successfully deleted grade with ID %s"
	GradeEdited     = "Successfully edited grade with ID %s"
	GradeRetrieved  = "Successfully retrieved the grade"

	//Errors constants
	GradeNotFound        = "Grade not found"
	InvalidParameters    = "Invalid parameters"
	MissingParameters    = "Missing parameters"
	ValueShouldBeGreater = "Grade value should be greater than zero"
	DeleteFailed         = "Failed to delete the grade"
	EditFailed           = "Failed to edit the grade"
)

Variables

This section is empty.

Functions

func AssertResponse

func AssertResponse(t *testing.T, response *httptest.ResponseRecorder, expectedResponse Response)

func ErrorMessageToJSON

func ErrorMessageToJSON(message string) string

func NewDeleteGradeRequest

func NewDeleteGradeRequest(id string) *http.Request

func NewEditGradeRequest

func NewEditGradeRequest(id string, grade services.Grade) *http.Request

func NewEditInvalidGradeRequest

func NewEditInvalidGradeRequest(id string, grade services.InvalidGrade) *http.Request

func NewGetGradeRequest

func NewGetGradeRequest(id string) *http.Request

func NewGetGradesByStudentRequest

func NewGetGradesByStudentRequest(student string) *http.Request

func NewGetGradesRequest

func NewGetGradesRequest() *http.Request

func NewPostGradeRequest

func NewPostGradeRequest(grade services.Grade) *http.Request

func NewPostInvalidGradeRequest

func NewPostInvalidGradeRequest(grade services.InvalidGrade) *http.Request

func ResultMessageAndDataToJSON

func ResultMessageAndDataToJSON(message, data string) string

Types

type Response

type Response struct {
	Header     http.Header
	Body       string
	StatusCode int
}

Jump to

Keyboard shortcuts

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