imap

package
v1.0.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: Apache-2.0 Imports: 17 Imported by: 5

README

Venom - Executor IMAP

Use case: your software send a mail? Venom can test if mail is received. Body of mail can be reused in further steps.

Input

name: TestSuite with IMAP Steps
testcases:
- name: TestCase IMAP
  steps:
  - type: imap
    imaphost: yourimaphost
    imapport: 993
    imapuser: yourimapuser
    imappassword: "yourimappassword"
    mbox: INBOX
    mboxonsuccess: mailsMatches
    searchfrom: '.*@your-domain.localhost'
    searchto: 'you@company.tld'
    searchsubject: 'Title of mail with *'
    searchbody: '.*a body content.*'
    assertions:
    - result.err ShouldNotExist
  • imaphost: imap host
  • imapport: optional, default: 993
  • imapuser: imap username
  • imappassword: imap password
  • searchfrom: optional
  • searchto: optional
  • searchsubject: optional
  • searchbody: optional
  • mbox: optional, default is INBOX
  • mboxonsuccess: optional. If not empty, move found mail (matching criteria) to another mbox.

Input must contain at least one of searchfrom, searchto, searchsubject or searchbody.

Output

  • result.err is there is an error.
  • result.subject: subject of searched mail
  • result.body: body of searched mail

Default assertion

result.err ShouldNotExist

Documentation

Index

Constants

View Source
const Name = "imap"

Name for test imap

Variables

This section is empty.

Functions

func New

func New() venom.Executor

New returns a new Test Exec

Types

type Executor

type Executor struct {
	IMAPHost        string `json:"imaphost,omitempty" yaml:"imaphost,omitempty"`
	IMAPPort        string `json:"imapport,omitempty" yaml:"imapport,omitempty"`
	IMAPUser        string `json:"imapuser,omitempty" yaml:"imapuser,omitempty"`
	IMAPPassword    string `json:"imappassword,omitempty" yaml:"imappassword,omitempty"`
	MBox            string `json:"mbox,omitempty" yaml:"mbox,omitempty"`
	MBoxOnSuccess   string `json:"mboxonsuccess,omitempty" yaml:"mboxonsuccess,omitempty"`
	DeleteOnSuccess bool   `json:"deleteonsuccess,omitempty" yaml:"deleteonsuccess,omitempty"`
	SearchFrom      string `json:"searchfrom,omitempty" yaml:"searchfrom,omitempty"`
	SearchTo        string `json:"searchto,omitempty" yaml:"searchto,omitempty"`
	SearchSubject   string `json:"searchsubject,omitempty" yaml:"searchsubject,omitempty"`
	SearchBody      string `json:"searchbody,omitempty" yaml:"searchbody,omitempty"`
}

Executor represents a Test Exec

func (Executor) GetDefaultAssertions

func (Executor) GetDefaultAssertions() *venom.StepAssertions

GetDefaultAssertions return default assertions for type exec

func (Executor) Run

func (Executor) Run(ctx context.Context, step venom.TestStep) (interface{}, error)

Run execute TestStep of type exec

func (Executor) ZeroValueResult added in v0.17.0

func (Executor) ZeroValueResult() interface{}

ZeroValueResult return an empty implementation of this executor result

type Mail

type Mail struct {
	From    string
	To      string
	Subject string
	UID     uint32
	Body    string
}

Mail contains an analyzed mail

type Result

type Result struct {
	Err         string  `json:"error" yaml:"error"`
	Subject     string  `json:"subject,omitempty" yaml:"subject,omitempty"`
	Body        string  `json:"body,omitempty" yaml:"body,omitempty"`
	TimeSeconds float64 `json:"timeSeconds,omitempty" yaml:"timeSeconds,omitempty"`
}

Result represents a step result

Jump to

Keyboard shortcuts

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