github.com/vnforks/kid@v5.11.1+incompatible/api4/ldap_test.go (about)

     1  // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package api4
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  func TestTestLdap(t *testing.T) {
    11  	th := Setup().InitBasic()
    12  	defer th.TearDown()
    13  
    14  	_, resp := th.Client.TestLdap()
    15  	CheckForbiddenStatus(t, resp)
    16  
    17  	_, resp = th.SystemAdminClient.TestLdap()
    18  	CheckNotImplementedStatus(t, resp)
    19  }
    20  
    21  func TestSyncLdap(t *testing.T) {
    22  	th := Setup().InitBasic()
    23  	defer th.TearDown()
    24  
    25  	_, resp := th.SystemAdminClient.SyncLdap()
    26  	CheckNoError(t, resp)
    27  
    28  	_, resp = th.Client.SyncLdap()
    29  	CheckForbiddenStatus(t, resp)
    30  }
    31  
    32  func TestGetLdapGroups(t *testing.T) {
    33  	th := Setup().InitBasic()
    34  	defer th.TearDown()
    35  
    36  	_, resp := th.Client.GetLdapGroups()
    37  	CheckForbiddenStatus(t, resp)
    38  
    39  	_, resp = th.SystemAdminClient.GetLdapGroups()
    40  	CheckNotImplementedStatus(t, resp)
    41  }
    42  
    43  func TestLinkLdapGroup(t *testing.T) {
    44  	const entryUUID string = "foo"
    45  
    46  	th := Setup().InitBasic()
    47  	defer th.TearDown()
    48  
    49  	_, resp := th.Client.LinkLdapGroup(entryUUID)
    50  	CheckForbiddenStatus(t, resp)
    51  
    52  	_, resp = th.SystemAdminClient.LinkLdapGroup(entryUUID)
    53  	CheckNotImplementedStatus(t, resp)
    54  }
    55  
    56  func TestUnlinkLdapGroup(t *testing.T) {
    57  	const entryUUID string = "foo"
    58  
    59  	th := Setup().InitBasic()
    60  	defer th.TearDown()
    61  
    62  	_, resp := th.Client.UnlinkLdapGroup(entryUUID)
    63  	CheckForbiddenStatus(t, resp)
    64  
    65  	_, resp = th.SystemAdminClient.UnlinkLdapGroup(entryUUID)
    66  	CheckNotImplementedStatus(t, resp)
    67  }