1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00
Files
go-chasquid-smtp/cmd/dovecot-auth-cli/dovecot-auth-cli.go
Alberto Bertogli 36692b52d3 dovecot: Include cli-based tests in the coverage tests
Many areas of the dovecot library are tested via chamuyero scripts, but
these were not being included in the coverage report.

This patch extends the dovecot-auth-cli tests so that they are now
coverage-aware.
2018-06-04 01:18:24 +01:00

38 lines
591 B
Go

// CLI used for testing the dovecot authentication package.
//
// NOT for production use.
// +build !coverage
package main
import (
"flag"
"fmt"
"blitiri.com.ar/go/chasquid/internal/dovecot"
)
func main() {
flag.Parse()
a := dovecot.NewAuth(flag.Arg(0)+"-userdb", flag.Arg(0)+"-client")
var ok bool
var err error
switch flag.Arg(1) {
case "exists":
ok, err = a.Exists(flag.Arg(2))
case "auth":
ok, err = a.Authenticate(flag.Arg(2), flag.Arg(3))
default:
fmt.Printf("unknown subcommand\n")
}
if ok {
fmt.Printf("yes\n")
return
}
fmt.Printf("no: %v\n", err)
}