Close the connection only if we establish it. (#18897)

This commit is contained in:
gotjosh
2019-09-16 14:13:35 +01:00
committed by GitHub
parent e9f1e86c8e
commit 99c799e9b7
5 changed files with 53 additions and 7 deletions

View File

@@ -19,6 +19,8 @@ type MockConnection struct {
DelParams *ldap.DelRequest
DelCalled bool
CloseCalled bool
UnauthenticatedBindCalled bool
BindCalled bool
@@ -49,7 +51,9 @@ func (c *MockConnection) UnauthenticatedBind(username string) error {
}
// Close mocks Close connection function
func (c *MockConnection) Close() {}
func (c *MockConnection) Close() {
c.CloseCalled = true
}
func (c *MockConnection) setSearchResult(result *ldap.SearchResult) {
c.SearchResult = result