diff --git a/ballerina/tests/Config.toml b/ballerina/tests/Config.toml new file mode 100644 index 0000000..e0d1d45 --- /dev/null +++ b/ballerina/tests/Config.toml @@ -0,0 +1,5 @@ +hostName = "host-name" +port = 389 +domainName = "domain@ad.com" +password = "password" +userDN = "CN=User,OU=People,DC=ad,DC=com" diff --git a/ballerina/tests/test.bal b/ballerina/tests/test.bal index 04da4c1..d508a32 100644 --- a/ballerina/tests/test.bal +++ b/ballerina/tests/test.bal @@ -22,12 +22,21 @@ configurable string domainName = ?; configurable string password = ?; configurable string userDN = ?; -Client ldapClient = check new ({ - hostName: hostName, - port: port, - domainName: domainName, - password: password -}); +boolean isTestOnLiveServer = false; + +Client ldapClient = test:mock(Client); + +@test:BeforeSuite +function initializeClientsForCalendarServer () returns error? { + if isTestOnLiveServer { + ldapClient = check new ({ + hostName: hostName, + port: port, + domainName: domainName, + password: password + }); + } +} @test:Config { enable: false