本文整理汇总了Golang中github.com/letsencrypt/boulder/test.AssertMarshaledEquals函数的典型用法代码示例。如果您正苦于以下问题:Golang AssertMarshaledEquals函数的具体用法?Golang AssertMarshaledEquals怎么用?Golang AssertMarshaledEquals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AssertMarshaledEquals函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestAddAuthorization
func TestAddAuthorization(t *testing.T) {
sa, _, cleanUp := initSA(t)
defer cleanUp()
reg := satest.CreateWorkingRegistration(t, sa)
PA := core.Authorization{RegistrationID: reg.ID}
PA, err := sa.NewPendingAuthorization(PA)
test.AssertNotError(t, err, "Couldn't create new pending authorization")
test.Assert(t, PA.ID != "", "ID shouldn't be blank")
dbPa, err := sa.GetAuthorization(PA.ID)
test.AssertNotError(t, err, "Couldn't get pending authorization with ID "+PA.ID)
test.AssertMarshaledEquals(t, PA, dbPa)
expectedPa := core.Authorization{ID: PA.ID}
test.AssertMarshaledEquals(t, dbPa.ID, expectedPa.ID)
combos := make([][]int, 1)
combos[0] = []int{0, 1}
exp := time.Now().AddDate(0, 0, 1)
identifier := core.AcmeIdentifier{Type: core.IdentifierDNS, Value: "wut.com"}
newPa := core.Authorization{ID: PA.ID, Identifier: identifier, RegistrationID: reg.ID, Status: core.StatusPending, Expires: &exp, Combinations: combos}
err = sa.UpdatePendingAuthorization(newPa)
test.AssertNotError(t, err, "Couldn't update pending authorization with ID "+PA.ID)
newPa.Status = core.StatusValid
err = sa.FinalizeAuthorization(newPa)
test.AssertNotError(t, err, "Couldn't finalize pending authorization with ID "+PA.ID)
dbPa, err = sa.GetAuthorization(PA.ID)
test.AssertNotError(t, err, "Couldn't get authorization with ID "+PA.ID)
}
开发者ID:BergkristalQuantumLabs,项目名称:boulder,代码行数:34,代码来源:storage-authority_test.go
示例2: TestAddAuthorization
func TestAddAuthorization(t *testing.T) {
sa := initSA(t)
PA := core.Authorization{}
PA, err := sa.NewPendingAuthorization(PA)
test.AssertNotError(t, err, "Couldn't create new pending authorization")
test.Assert(t, PA.ID != "", "ID shouldn't be blank")
dbPa, err := sa.GetAuthorization(PA.ID)
test.AssertNotError(t, err, "Couldn't get pending authorization with ID "+PA.ID)
test.AssertMarshaledEquals(t, PA, dbPa)
expectedPa := core.Authorization{ID: PA.ID}
test.AssertMarshaledEquals(t, dbPa.ID, expectedPa.ID)
var jwk jose.JsonWebKey
err = json.Unmarshal([]byte(theKey), &jwk)
if err != nil {
t.Errorf("JSON unmarshal error: %+v", err)
return
}
uu, err := url.Parse("test.com")
u := core.AcmeURL(*uu)
chall := core.Challenge{Type: "simpleHttp", Status: core.StatusPending, URI: u, Token: "THISWOULDNTBEAGOODTOKEN", Path: "test-me"}
combos := make([][]int, 1)
combos[0] = []int{0, 1}
exp := time.Now().AddDate(0, 0, 1)
newPa := core.Authorization{ID: PA.ID, Identifier: core.AcmeIdentifier{Type: core.IdentifierDNS, Value: "wut.com"}, RegistrationID: 0, Status: core.StatusPending, Expires: &exp, Challenges: []core.Challenge{chall}, Combinations: combos}
err = sa.UpdatePendingAuthorization(newPa)
test.AssertNotError(t, err, "Couldn't update pending authorization with ID "+PA.ID)
newPa.Status = core.StatusValid
err = sa.FinalizeAuthorization(newPa)
test.AssertNotError(t, err, "Couldn't finalize pending authorization with ID "+PA.ID)
dbPa, err = sa.GetAuthorization(PA.ID)
test.AssertNotError(t, err, "Couldn't get authorization with ID "+PA.ID)
}
开发者ID:diafygi,项目名称:boulder,代码行数:43,代码来源:storage-authority_test.go
示例3: TestAddAuthorization
func TestAddAuthorization(t *testing.T) {
sa, cleanUp := initSA(t)
defer cleanUp()
PA := core.Authorization{}
PA, err := sa.NewPendingAuthorization(PA)
test.AssertNotError(t, err, "Couldn't create new pending authorization")
test.Assert(t, PA.ID != "", "ID shouldn't be blank")
dbPa, err := sa.GetAuthorization(PA.ID)
test.AssertNotError(t, err, "Couldn't get pending authorization with ID "+PA.ID)
test.AssertMarshaledEquals(t, PA, dbPa)
expectedPa := core.Authorization{ID: PA.ID}
test.AssertMarshaledEquals(t, dbPa.ID, expectedPa.ID)
var jwk jose.JsonWebKey
err = json.Unmarshal([]byte(theKey), &jwk)
if err != nil {
t.Errorf("JSON unmarshal error: %+v", err)
return
}
combos := make([][]int, 1)
combos[0] = []int{0, 1}
exp := time.Now().AddDate(0, 0, 1)
identifier := core.AcmeIdentifier{Type: core.IdentifierDNS, Value: "wut.com"}
newPa := core.Authorization{ID: PA.ID, Identifier: identifier, RegistrationID: 0, Status: core.StatusPending, Expires: &exp, Combinations: combos}
err = sa.UpdatePendingAuthorization(newPa)
test.AssertNotError(t, err, "Couldn't update pending authorization with ID "+PA.ID)
newPa.Status = core.StatusValid
err = sa.FinalizeAuthorization(newPa)
test.AssertNotError(t, err, "Couldn't finalize pending authorization with ID "+PA.ID)
dbPa, err = sa.GetAuthorization(PA.ID)
test.AssertNotError(t, err, "Couldn't get authorization with ID "+PA.ID)
}
开发者ID:modulexcite,项目名称:boulder,代码行数:40,代码来源:storage-authority_test.go
示例4: TestAcmeURLSlice
func TestAcmeURLSlice(t *testing.T) {
tc := BoulderTypeConverter{}
var au, out []*core.AcmeURL
marshaledI, err := tc.ToDb(au)
test.AssertNotError(t, err, "Could not ToDb")
scanner, ok := tc.FromDb(&out)
test.Assert(t, ok, "FromDb failed")
if !ok {
t.FailNow()
return
}
marshaled := marshaledI.(string)
err = scanner.Binder(&marshaled, &out)
test.AssertMarshaledEquals(t, au, out)
}
开发者ID:MTRNord,项目名称:boulder-freifunk_support,代码行数:18,代码来源:type-converter_test.go
示例5: TestOCSPStatus
func TestOCSPStatus(t *testing.T) {
tc := BoulderTypeConverter{}
var os, out core.OCSPStatus
os = "core.OCSPStatus"
marshaledI, err := tc.ToDb(os)
test.AssertNotError(t, err, "Could not ToDb")
scanner, ok := tc.FromDb(&out)
test.Assert(t, ok, "FromDb failed")
if !ok {
t.FailNow()
return
}
marshaled := marshaledI.(string)
err = scanner.Binder(&marshaled, &out)
test.AssertMarshaledEquals(t, os, out)
}
开发者ID:MTRNord,项目名称:boulder-freifunk_support,代码行数:20,代码来源:type-converter_test.go
示例6: TestAcmeIdentifier
func TestAcmeIdentifier(t *testing.T) {
tc := BoulderTypeConverter{}
ai := core.AcmeIdentifier{Type: "data1", Value: "data2"}
out := core.AcmeIdentifier{}
marshaledI, err := tc.ToDb(ai)
test.AssertNotError(t, err, "Could not ToDb")
scanner, ok := tc.FromDb(&out)
test.Assert(t, ok, "FromDb failed")
if !ok {
t.FailNow()
return
}
marshaled := marshaledI.(string)
err = scanner.Binder(&marshaled, &out)
test.AssertMarshaledEquals(t, ai, out)
}
开发者ID:MTRNord,项目名称:boulder-freifunk_support,代码行数:20,代码来源:type-converter_test.go
示例7: TestJsonWebKey
func TestJsonWebKey(t *testing.T) {
tc := BoulderTypeConverter{}
var jwk, out jose.JsonWebKey
json.Unmarshal([]byte(JWK1JSON), &jwk)
marshaledI, err := tc.ToDb(jwk)
test.AssertNotError(t, err, "Could not ToDb")
scanner, ok := tc.FromDb(&out)
test.Assert(t, ok, "FromDb failed")
if !ok {
t.FailNow()
return
}
marshaled := marshaledI.(string)
err = scanner.Binder(&marshaled, &out)
test.AssertMarshaledEquals(t, jwk, out)
}
开发者ID:diafygi,项目名称:boulder,代码行数:20,代码来源:type-converter_test.go
注:本文中的github.com/letsencrypt/boulder/test.AssertMarshaledEquals函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论