mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 20:47:44 +00:00
v2 swagger scopes added to what-changed.
Added hashing functions to all v2 and v3 models that handle security, thats the next target.
This commit is contained in:
@@ -346,3 +346,36 @@ biscuit:
|
||||
assert.Equal(t, ObjectRemoved, extChanges.Changes[0].ChangeType)
|
||||
assert.Equal(t, "rich tea", extChanges.Changes[0].Original)
|
||||
}
|
||||
|
||||
func TestCompareSecurityRequirement_Add(t *testing.T) {
|
||||
|
||||
left := `
|
||||
biscuit:
|
||||
- biscotti
|
||||
- rich tea`
|
||||
|
||||
right := `punch:
|
||||
- nice
|
||||
cheese:
|
||||
- pizza
|
||||
- pie
|
||||
biscuit:
|
||||
- biscotti
|
||||
- rich tea`
|
||||
|
||||
var lNode, rNode yaml.Node
|
||||
_ = yaml.Unmarshal([]byte(left), &lNode)
|
||||
_ = yaml.Unmarshal([]byte(right), &rNode)
|
||||
|
||||
// create low level objects
|
||||
var lDoc v2.SecurityRequirement
|
||||
var rDoc v2.SecurityRequirement
|
||||
_ = low.BuildModel(&lNode, &lDoc)
|
||||
_ = low.BuildModel(&rNode, &rDoc)
|
||||
_ = lDoc.Build(lNode.Content[0], nil)
|
||||
_ = rDoc.Build(rNode.Content[0], nil)
|
||||
|
||||
// compare
|
||||
extChanges := CompareSecurityRequirement(&lDoc, &rDoc)
|
||||
assert.Nil(t, extChanges)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user