本文整理汇总了Golang中pkg/re/check/v1.C.Fatal方法的典型用法代码示例。如果您正苦于以下问题:Golang C.Fatal方法的具体用法?Golang C.Fatal怎么用?Golang C.Fatal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pkg/re/check/v1.C
的用法示例。
在下文中一共展示了C.Fatal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SetUpSuite
func (s *KNFSuite) SetUpSuite(c *check.C) {
tmpdir := c.MkDir()
s.ConfigPath = tmpdir + "/" + _CONFIG_FILE_NAME
s.EmptyConfigPath = tmpdir + "/" + _CONFIG_EMPTY_FILE_NAME
s.MalformedConfigPath = tmpdir + "/" + _CONFIG_MALFORMED_FILE_NAME
err := ioutil.WriteFile(s.ConfigPath, []byte(_CONFIG_DATA), 0644)
if err != nil {
c.Fatal(err.Error())
}
err = ioutil.WriteFile(s.EmptyConfigPath, []byte(""), 0644)
if err != nil {
c.Fatal(err.Error())
}
err = ioutil.WriteFile(s.MalformedConfigPath, []byte(_CONFIG_MALF_DATA), 0644)
if err != nil {
c.Fatal(err.Error())
}
}
示例2: TestAnalyze
func (s *SSLLabsSuite) TestAnalyze(c *check.C) {
api, err := NewAPI("SSLScanTester", "4.0.0")
c.Assert(api, check.NotNil)
c.Assert(err, check.IsNil)
progress, err := api.Analyze("https://api.ssllabs.com")
c.Assert(progress, check.NotNil)
c.Assert(err, check.IsNil)
var info *AnalyzeInfo
fmt.Printf("Progress: ")
for {
info, err = progress.Info()
c.Assert(info, check.NotNil)
c.Assert(err, check.IsNil)
if info.Status == STATUS_ERROR {
c.Fatal(info.StatusMessage)
}
if info.Status == STATUS_READY {
break
}
fmt.Printf(".")
time.Sleep(5 * time.Second)
}
fmt.Println(" DONE")
c.Assert(info.Host, check.Equals, "https://api.ssllabs.com")
c.Assert(info.Port, check.Equals, 443)
c.Assert(info.Protocol, check.Equals, "HTTP")
c.Assert(info.IsPublic, check.Equals, false)
c.Assert(info.Status, check.Equals, "READY")
c.Assert(info.Endpoints, check.Not(check.HasLen), 0)
c.Assert(info.Endpoints[0].IPAdress, check.Equals, "64.41.200.100")
c.Assert(info.Endpoints[0].ServerName, check.Equals, "www.ssllabs.com")
c.Assert(info.Endpoints[0].Grade, check.Equals, "A")
c.Assert(info.Endpoints[0].GradeTrustIgnored, check.Equals, "A")
c.Assert(info.Endpoints[0].HasWarnings, check.Equals, false)
c.Assert(info.Endpoints[0].IsExceptional, check.Equals, false)
c.Assert(info.Endpoints[0].Progress, check.Equals, 100)
c.Assert(info.Endpoints[0].Delegation, check.Equals, 1)
c.Assert(info.Endpoints[0].Details, check.IsNil)
detailedInfo, err := progress.DetailedInfo(info.Endpoints[0].IPAdress)
c.Assert(err, check.IsNil)
c.Assert(detailedInfo, check.NotNil)
c.Assert(detailedInfo.Details, check.NotNil)
details := detailedInfo.Details
c.Assert(details.Key, check.NotNil)
c.Assert(details.Key.Size, check.Equals, 2048)
c.Assert(details.Key.Alg, check.Equals, "RSA")
c.Assert(details.Key.DebianFlaw, check.Equals, false)
c.Assert(details.Key.Strength, check.Equals, 2048)
c.Assert(details.Cert, check.NotNil)
c.Assert(details.Cert.Subject, check.Equals, "CN=ssllabs.com,O=Qualys, Inc.,L=Redwood City,ST=California,C=US")
c.Assert(details.Cert.CommonNames, check.DeepEquals, []string{"ssllabs.com"})
c.Assert(details.Cert.AltNames, check.DeepEquals, []string{"ssllabs.com", "*.ssllabs.com"})
c.Assert(details.Cert.IssuerSubject, check.Equals, "CN=Entrust Certification Authority - L1K,OU=(c) 2012 Entrust, Inc. - for authorized use only,OU=See www.entrust.net/legal-terms,O=Entrust, Inc.,C=US")
c.Assert(details.Cert.IssuerLabel, check.Equals, "Entrust Certification Authority - L1K")
c.Assert(details.Cert.SigAlg, check.Equals, "SHA256withRSA")
c.Assert(details.Cert.RevocationInfo, check.Equals, 3)
c.Assert(details.Cert.CRLURIs, check.DeepEquals, []string{"http://crl.entrust.net/level1k.crl"})
c.Assert(details.Cert.OCSPURIs, check.DeepEquals, []string{"http://ocsp.entrust.net"})
c.Assert(details.Cert.RevocationStatus, check.Equals, REVOCATION_STATUS_NOT_REVOKED)
c.Assert(details.Cert.CRLRevocationStatus, check.Equals, REVOCATION_STATUS_NOT_REVOKED)
c.Assert(details.Cert.OCSPRevocationStatus, check.Equals, REVOCATION_STATUS_NOT_REVOKED)
c.Assert(details.Cert.SGC, check.Equals, 0)
c.Assert(details.Cert.ValidationType, check.Equals, "")
c.Assert(details.Cert.Issues, check.Equals, 0)
c.Assert(details.Cert.SCT, check.Equals, false)
c.Assert(details.Cert.MustStaple, check.Equals, 0)
c.Assert(details.Cert.SHA1Hash, check.Equals, "4c91b922af1d09702f9b6240da931b795445f70d")
c.Assert(details.Cert.PINSHA256, check.Equals, "xkWf9Qfs1uZi2NcMV3Gdnrz1UF4FNAslzApMTwynaMU=")
c.Assert(details.Chain, check.NotNil)
c.Assert(details.Chain.Certs, check.Not(check.HasLen), 0)
c.Assert(details.Chain.Issues, check.Equals, 0)
c.Assert(details.Chain.Certs[0], check.NotNil)
c.Assert(details.Chain.Certs[0].Subject, check.Equals, "CN=ssllabs.com,O=Qualys, Inc.,L=Redwood City,ST=California,C=US")
c.Assert(details.Chain.Certs[0].Label, check.Equals, "ssllabs.com")
c.Assert(details.Chain.Certs[0].NotBefore, check.Not(check.Equals), int64(0))
c.Assert(details.Chain.Certs[0].NotAfter, check.Not(check.Equals), int64(0))
c.Assert(details.Chain.Certs[0].IssuerSubject, check.Equals, "CN=Entrust Certification Authority - L1K,OU=(c) 2012 Entrust, Inc. - for authorized use only,OU=See www.entrust.net/legal-terms,O=Entrust, Inc.,C=US")
c.Assert(details.Chain.Certs[0].IssuerLabel, check.Equals, "Entrust Certification Authority - L1K")
c.Assert(details.Chain.Certs[0].SigAlg, check.Equals, "SHA256withRSA")
//.........这里部分代码省略.........