-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove path map manipulations into types/signature.go & fix ValidateEx()
- Loading branch information
Serge Lysenko
committed
Oct 27, 2022
1 parent
8b036be
commit 845f74f
Showing
6 changed files
with
134 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package types | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/austdev/goxmldsig/etreeutils" | ||
|
||
"github.com/beevik/etree" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestMapPathAndRemove(t *testing.T) { | ||
doc := etree.NewDocument() | ||
err := doc.ReadFromString(`<X><Y/><Y><RemoveMe xmlns="x"/></Y></X>`) | ||
require.NoError(t, err) | ||
|
||
el, err := etreeutils.NSFindOne(doc.Root(), "x", "RemoveMe") | ||
require.NoError(t, err) | ||
require.NotNil(t, el) | ||
|
||
path := mapPathToElement(doc.Root(), el) | ||
removed := removeElementAtPath(doc.Root(), path) | ||
require.True(t, removed) | ||
|
||
el, err = etreeutils.NSFindOne(doc.Root(), "x", "RemoveMe") | ||
require.NoError(t, err) | ||
require.Nil(t, el) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters