Add result summary support for IM tests
This commit is contained in:
parent
98e95b8b7e
commit
e56ce73006
4 changed files with 114 additions and 11 deletions
|
|
@ -21,16 +21,36 @@ type WhatsAppSummary struct {
|
|||
RegistrationServerBlocking bool
|
||||
WebBlocking bool
|
||||
EndpointsBlocking bool
|
||||
Blocked bool
|
||||
}
|
||||
|
||||
// Summary generates a summary for a test run
|
||||
func (h WhatsApp) Summary(tk map[string]interface{}) interface{} {
|
||||
const blk = "blocked"
|
||||
var (
|
||||
webBlocking bool
|
||||
registrationBlocking bool
|
||||
endpointsBlocking bool
|
||||
)
|
||||
|
||||
var computeBlocking = func(key string) bool {
|
||||
const blk = "blocked"
|
||||
if tk[key] == nil {
|
||||
return false
|
||||
}
|
||||
if tk[key].(string) == blk {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
registrationBlocking = computeBlocking("registration_server_status")
|
||||
webBlocking = computeBlocking("whatsapp_web_status")
|
||||
endpointsBlocking = computeBlocking("whatsapp_endpoints_status")
|
||||
|
||||
return WhatsAppSummary{
|
||||
RegistrationServerBlocking: tk["registration_server_status"].(string) == blk,
|
||||
WebBlocking: tk["whatsapp_web_status"].(string) == blk,
|
||||
EndpointsBlocking: tk["whatsapp_endpoints_status"].(string) == blk,
|
||||
RegistrationServerBlocking: registrationBlocking,
|
||||
WebBlocking: webBlocking,
|
||||
EndpointsBlocking: endpointsBlocking,
|
||||
Blocked: registrationBlocking || webBlocking || endpointsBlocking,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue