Skip to content

Commit

Permalink
Merge "[ FAB-5726 ] Test dyn add/mod/del identites"
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith Smith authored and Gerrit Code Review committed Feb 7, 2018
2 parents 626f8a7 + b9d3e01 commit 7d487dd
Show file tree
Hide file tree
Showing 2 changed files with 516 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/serveraffiliations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,19 @@ func TestAffiliationNode(t *testing.T) {
an.insertByName("a.b.c")
an.insertByName("a")
an.insertByName("a.c.b")
an.insertByName("a.d.b.c.e.f.g.h.i.j.z")
root := an.GetRoot()
assert.Equal(t, root.Name, "a")
assert.Equal(t, root.Affiliations[0].Name, "a.b")
assert.Equal(t, root.Affiliations[0].Affiliations[0].Name, "a.b.c")
assert.Equal(t, root.Affiliations[1].Name, "a.c")
assert.Equal(t, root.Affiliations[1].Affiliations[0].Name, "a.c.b")
assert.True(t, searchChildren(root.Affiliations, "a.b"))
assert.True(t, searchChildren(root.Affiliations, "a.b.c"))
assert.True(t, searchChildren(root.Affiliations, "a.c"))
assert.True(t, searchChildren(root.Affiliations, "a.d.b.c.e.f.g.h.i.j"))
assert.False(t, searchChildren(root.Affiliations, "b"))
assert.False(t, searchChildren(root.Affiliations, "c.b"))
assert.False(t, searchChildren(root.Affiliations, "z"))
an.insertByName("x")
root = an.GetRoot()
assert.Equal(t, root.Name, "")
}

func searchTree(resp *api.AffiliationResponse, find string) bool {
Expand Down
Loading

0 comments on commit 7d487dd

Please sign in to comment.