tests

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2017 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KEY_STATUS = "expected-status"
	KEY_BODY   = "expected-body"
	KEY_FILTER = "expected-filter"
)
View Source
const ABC_NICK = "0123456789abcdefghijklmnopqrstuvwxyz_."
View Source
const ABC_SLUG = "0123456789abcdefghijklmnopqrstuvwxyz_-"
View Source
const POST_FAKE_ID int64 = 2139800938
View Source
const THREAD_FAKE_ID = "2139800939"

Variables

This section is empty.

Functions

func CheckClear added in v0.1.0

func CheckClear(c *client.Forum)

func CheckForum

func CheckForum(c *client.Forum, forum *models.Forum)

func CheckForumCreateConflict

func CheckForumCreateConflict(c *client.Forum, m *Modify)

func CheckForumCreateSimple

func CheckForumCreateSimple(c *client.Forum)

func CheckForumCreateUnicode

func CheckForumCreateUnicode(c *client.Forum)

func CheckForumCreateUserCase

func CheckForumCreateUserCase(c *client.Forum, m *Modify)

func CheckForumCreateUserNotFound

func CheckForumCreateUserNotFound(c *client.Forum)

func CheckForumGetOneNocase

func CheckForumGetOneNocase(c *client.Forum, m *Modify)

func CheckForumGetOneNotFound

func CheckForumGetOneNotFound(c *client.Forum)

func CheckForumGetOneSimple

func CheckForumGetOneSimple(c *client.Forum)

func CheckForumGetThreadsNotFound added in v0.1.0

func CheckForumGetThreadsNotFound(c *client.Forum, m *Modify)

func CheckForumGetThreadsSimple added in v0.1.0

func CheckForumGetThreadsSimple(c *client.Forum, m *Modify)

func CheckForumGetUsersCollation added in v0.2.0

func CheckForumGetUsersCollation(c *client.Forum, m *Modify)

func CheckForumGetUsersEmpty added in v0.1.0

func CheckForumGetUsersEmpty(c *client.Forum, m *Modify)

func CheckForumGetUsersNotFound added in v0.1.0

func CheckForumGetUsersNotFound(c *client.Forum, m *Modify)

func CheckForumGetUsersSimple added in v0.1.0

func CheckForumGetUsersSimple(c *client.Forum, m *Modify)

func CheckForumGetUsersVote added in v0.1.0

func CheckForumGetUsersVote(c *client.Forum, m *Modify)

func CheckIsType

func CheckIsType(expectedType interface{}, object interface{})

func CheckNil

func CheckNil(err interface{})

func CheckPost

func CheckPost(c *client.Forum, post *models.Post)

func CheckPostCreateDeepParent added in v0.1.0

func CheckPostCreateDeepParent(c *client.Forum)

func CheckPostCreateEmpty added in v0.1.0

func CheckPostCreateEmpty(c *client.Forum, m *Modify)

func CheckPostCreateInvalidParent added in v0.1.0

func CheckPostCreateInvalidParent(c *client.Forum, m *Modify)

func CheckPostCreateNoAuthor added in v0.1.0

func CheckPostCreateNoAuthor(c *client.Forum, m *Modify)

func CheckPostCreateNoThread added in v0.1.0

func CheckPostCreateNoThread(c *client.Forum, m *Modify)

func CheckPostCreateSimple

func CheckPostCreateSimple(c *client.Forum, m *Modify)

func CheckPostCreateUnicode added in v0.1.0

func CheckPostCreateUnicode(c *client.Forum)

func CheckPostCreateWithParent added in v0.1.0

func CheckPostCreateWithParent(c *client.Forum)

func CheckPostGetOneNotFound added in v0.1.0

func CheckPostGetOneNotFound(c *client.Forum, m *Modify)

func CheckPostGetOneRelated added in v0.1.0

func CheckPostGetOneRelated(c *client.Forum, m *Modify)

func CheckPostGetOneSimple added in v0.1.0

func CheckPostGetOneSimple(c *client.Forum)

func CheckPostUpdateCase added in v0.1.0

func CheckPostUpdateCase(c *client.Forum)

func CheckPostUpdateEmpty added in v0.1.0

func CheckPostUpdateEmpty(c *client.Forum)

func CheckPostUpdateNotFound added in v0.1.0

func CheckPostUpdateNotFound(c *client.Forum)

func CheckPostUpdateSame added in v0.1.0

func CheckPostUpdateSame(c *client.Forum)

func CheckPostUpdateSimple added in v0.1.0

func CheckPostUpdateSimple(c *client.Forum)

func CheckStatus added in v0.1.0

func CheckStatus(c *client.Forum)

func CheckThread

func CheckThread(c *client.Forum, thread *models.Thread)

func CheckThreadCreateConflict added in v0.1.0

func CheckThreadCreateConflict(c *client.Forum, m *Modify)

func CheckThreadCreateNoAuthor added in v0.1.0

func CheckThreadCreateNoAuthor(c *client.Forum)

func CheckThreadCreateNoCase added in v0.1.0

func CheckThreadCreateNoCase(c *client.Forum, m *Modify)

func CheckThreadCreateNoForum added in v0.1.0

func CheckThreadCreateNoForum(c *client.Forum)

func CheckThreadCreateSimple

func CheckThreadCreateSimple(c *client.Forum, m *Modify)

func CheckThreadCreateUnicode added in v0.1.0

func CheckThreadCreateUnicode(c *client.Forum)

func CheckThreadGetOneNotFound added in v0.1.0

func CheckThreadGetOneNotFound(c *client.Forum)

func CheckThreadGetOneSimple added in v0.1.0

func CheckThreadGetOneSimple(c *client.Forum, m *Modify)

func CheckThreadGetPostsNotFound added in v0.1.0

func CheckThreadGetPostsNotFound(c *client.Forum)

func CheckThreadGetPostsSimple added in v0.1.0

func CheckThreadGetPostsSimple(c *client.Forum, m *Modify)

func CheckThreadUpdateEmpty added in v0.1.0

func CheckThreadUpdateEmpty(c *client.Forum)

func CheckThreadUpdateNotFound added in v0.1.0

func CheckThreadUpdateNotFound(c *client.Forum)

func CheckThreadUpdatePart added in v0.1.0

func CheckThreadUpdatePart(c *client.Forum, m *Modify)

func CheckThreadUpdateSimple added in v0.1.0

func CheckThreadUpdateSimple(c *client.Forum, m *Modify)

func CheckThreadVoteSimple added in v0.1.0

func CheckThreadVoteSimple(c *client.Forum)

func CheckThreadVoteThreadNotFound added in v0.1.0

func CheckThreadVoteThreadNotFound(c *client.Forum)

func CheckThreadVoteUserNotFound added in v0.1.0

func CheckThreadVoteUserNotFound(c *client.Forum)

func CheckUser

func CheckUser(c *client.Forum, user *models.User)

func CheckUserCreateConflict

func CheckUserCreateConflict(c *client.Forum, m *Modify)

func CheckUserCreateSimple

func CheckUserCreateSimple(c *client.Forum)

func CheckUserCreateUnicode

func CheckUserCreateUnicode(c *client.Forum)

func CheckUserGetOneNocase

func CheckUserGetOneNocase(c *client.Forum, m *Modify)

func CheckUserGetOneNotFound

func CheckUserGetOneNotFound(c *client.Forum)

func CheckUserGetOneSimple

func CheckUserGetOneSimple(c *client.Forum)

func CheckUserUpdateConflict

func CheckUserUpdateConflict(c *client.Forum, m *Modify)

func CheckUserUpdateEmpty

func CheckUserUpdateEmpty(c *client.Forum)

func CheckUserUpdateNotFound

func CheckUserUpdateNotFound(c *client.Forum)

func CheckUserUpdatePart

func CheckUserUpdatePart(c *client.Forum, m *Modify)

func CheckUserUpdateSimple

func CheckUserUpdateSimple(c *client.Forum)

func Checkpoint

func Checkpoint(c *client.Forum, message string) bool

func Colorize added in v0.2.0

func Colorize(color int, message string) string

func CreateForum

func CreateForum(c *client.Forum, forum *models.Forum, owner *models.User) *models.Forum

func CreatePost

func CreatePost(c *client.Forum, post *models.Post, thread *models.Thread) *models.Post

func CreatePosts added in v0.1.0

func CreatePosts(c *client.Forum, posts []*models.Post, thread *models.Thread) []*models.Post

func CreateThread

func CreateThread(c *client.Forum, thread *models.Thread, forum *models.Forum, author *models.User) *models.Thread

func CreateTransport added in v0.2.0

func CreateTransport(url *url.URL) *http_transport.Runtime

func CreateUser

func CreateUser(c *client.Forum, user *models.User) *models.User

func DeltaToHtml added in v0.2.0

func DeltaToHtml(delta []difflib.DiffRecord) string

func DeltaToText added in v0.2.0

func DeltaToText(delta []difflib.DiffRecord) string

func Expected

func Expected(statusCode int, body interface{}, prepare Filter) context.Context

func Fill added in v0.2.0

func Fill(url *url.URL) int

func FillUsers added in v0.2.0

func FillUsers(c *client.Forum, parallel int, count int) []*models.User

func GetBody

func GetBody(stream *io.ReadCloser) ([]byte, error)

func GetDelta

func GetDelta(data []byte, expected interface{}, prepare Filter) *[]difflib.DiffRecord

func GetDiff

func GetDiff(actual string, expected string) *[]difflib.DiffRecord

func InvertCase added in v0.1.0

func InvertCase(str string) string

func Modifications added in v0.1.0

func Modifications(checker func(c *client.Forum, modify *Modify)) func(c *client.Forum)

func ObjectsAreEqual

func ObjectsAreEqual(expected, actual interface{}) bool

func PrettyJson added in v0.2.0

func PrettyJson(body string) string

func RandomEmail

func RandomEmail() strfmt.Email

func RandomForum

func RandomForum() *models.Forum

func RandomMarker added in v0.1.0

func RandomMarker() string

func RandomNickname

func RandomNickname() string

func RandomPost

func RandomPost() *models.Post

func RandomThread

func RandomThread() *models.Thread

func RandomTime added in v0.1.0

func RandomTime() time.Time

func RandomUser

func RandomUser() *models.User

func Register

func Register(checker Checker)

func Run

func Run(url *url.URL, mask *regexp.Regexp, report_file string, keep bool) int

func RunCheck

func RunCheck(check Checker, report *Report, url *url.URL)

func SortPosts added in v0.1.0

func SortPosts(posts []OrderedPost, desc bool, limitType func(OrderedPost) int, limit int) [][]*models.Post

func ToJson

func ToJson(obj interface{}) string

Types

type Abc added in v0.2.0

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

Алфавит

func NewAbc added in v0.2.0

func NewAbc(alphabet string) Abc

NewAbc constructs a new instance of shuffled alphabet to be used for Id representation.

func (*Abc) Encode added in v0.2.0

func (abc *Abc) Encode(val, bits uint) []rune

Encode encodes a given value into a slice of runes of length nsymbols. In case nsymbols==0, the length of the result is automatically computed from data. Even if fewer symbols is required to encode the data than nsymbols, all positions are used encoding 0 where required to guarantee uniqueness in case further data is added to the sequence. The value of digits [4,6] represents represents n in 2^n, which defines how much randomness flows into the algorithm: 4 -- every value can be represented by 4 symbols in the alphabet (permitting at most 16 values), 5 -- every value can be represented by 2 symbols in the alphabet (permitting at most 32 values), 6 -- every value is represented by exactly 1 symbol with no randomness (permitting 64 values).

type Checker

type Checker struct {
	// Имя текущей проверки.
	Name string
	// Описание текущей проверки.
	Description string
	// Функция для текущей проверки.
	FnCheck func(c *client.Forum)
	// Тесты, без которых проверка не имеет смысл.
	Deps []string
}

func SortedChecks added in v0.2.0

func SortedChecks() []Checker

type CheckerByName added in v0.2.0

type CheckerByName []Checker

func (CheckerByName) Len added in v0.2.0

func (a CheckerByName) Len() int

func (CheckerByName) Less added in v0.2.0

func (a CheckerByName) Less(i, j int) bool

func (CheckerByName) Swap added in v0.2.0

func (a CheckerByName) Swap(i, j int)

type CheckerTransport

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

func (*CheckerTransport) Submit

func (self *CheckerTransport) Submit(operation *runtime.ClientOperation) (interface{}, error)

type Filter

type Filter func(interface{}) interface{}

type Modify added in v0.1.0

type Modify int

func (*Modify) Bool added in v0.1.0

func (self *Modify) Bool() bool

func (*Modify) Case added in v0.1.0

func (self *Modify) Case(source string) string

func (*Modify) Int added in v0.1.0

func (self *Modify) Int(n int) int

func (*Modify) NullableBool added in v0.1.0

func (self *Modify) NullableBool() *bool

func (*Modify) SlugOrId added in v0.1.0

func (self *Modify) SlugOrId(thread *models.Thread) string

type OrderedPost added in v0.1.0

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

func CreateTree added in v0.1.0

func CreateTree(c *client.Forum, thread *models.Thread) []OrderedPost

type PostSortTree added in v0.1.0

type PostSortTree []OrderedPost

func (PostSortTree) Len added in v0.1.0

func (a PostSortTree) Len() int

func (PostSortTree) Less added in v0.1.0

func (a PostSortTree) Less(i, j int) bool

func (PostSortTree) Swap added in v0.1.0

func (a PostSortTree) Swap(i, j int)

type Report

type Report struct {
	Checker   Checker
	Pass      []ReportPass
	SkippedBy []string
	Result    ResultType
}

func (*Report) AddError

func (self *Report) AddError(err interface{})

func (*Report) Checkpoint

func (self *Report) Checkpoint(message string) bool

func (*Report) RoundTrip

func (self *Report) RoundTrip(req *http.Request, res *http.Response, example *http.Response, delta *[]difflib.DiffRecord)

func (*Report) Skip added in v0.2.0

func (self *Report) Skip(message string)

type ReportHttp added in v0.2.0

type ReportHttp struct {
	Title    string
	Header   http.Header
	BodyRaw  string
	BodyJson string
}

func RequestInfo added in v0.2.0

func RequestInfo(req *http.Request) *ReportHttp

func ResponseInfo added in v0.2.0

func ResponseInfo(res *http.Response) *ReportHttp

func (*ReportHttp) String added in v0.2.0

func (self *ReportHttp) String() string

type ReportMessage added in v0.2.0

type ReportMessage struct {
	Url      string
	Delta    template.HTML
	Request  *ReportHttp
	Response *ReportHttp
	Example  *ReportHttp
}

type ReportPass added in v0.2.0

type ReportPass struct {
	Name     string
	Failure  string
	Messages []ReportMessage
}

type ResultType added in v0.2.0

type ResultType int
const (
	Failed ResultType = iota
	Skipped
	Success
)

type Shortid added in v0.2.0

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

Идентификатор

func NewShortid added in v0.2.0

func NewShortid(alphabet string) *Shortid

Создание нового генератора

func (*Shortid) Abc added in v0.2.0

func (sid *Shortid) Abc() Abc

Abc returns the instance of alphabet used for representing the Ids.

func (*Shortid) Epoch added in v0.2.0

func (sid *Shortid) Epoch() time.Time

Epoch returns the value of epoch used as the beginning of millisecond counting (normally 2016-01-01 00:00:00 local time)

func (*Shortid) Generate added in v0.2.0

func (sid *Shortid) Generate() string

func (*Shortid) GenerateRandom added in v0.2.0

func (sid *Shortid) GenerateRandom() []rune

Generate generates a new short Id.

type ThreadByCreated added in v0.1.0

type ThreadByCreated []models.Thread

func (ThreadByCreated) Len added in v0.1.0

func (a ThreadByCreated) Len() int

func (ThreadByCreated) Less added in v0.1.0

func (a ThreadByCreated) Less(i, j int) bool

func (ThreadByCreated) Swap added in v0.1.0

func (a ThreadByCreated) Swap(i, j int)

type UserByNickname

type UserByNickname []models.User

func (UserByNickname) Len

func (a UserByNickname) Len() int

func (UserByNickname) Less

func (a UserByNickname) Less(i, j int) bool

func (UserByNickname) Swap

func (a UserByNickname) Swap(i, j int)

type Validator

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

func NewValidator

func NewValidator(ctx context.Context, report *Report) *Validator

func (*Validator) Example

func (self *Validator) Example(req *http.Request) *http.Response

func (*Validator) RoundTrip

func (self *Validator) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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