コード例 #1
0
def test_updateGroupMembers_cas_Normal(test_config):
    GroupService.updateGroupMembers(test_config['groupname'],
                                    test_config['autre_accountname'])
    group = GroupService.getGroup(test_config['groupname'])
    assert (test_config['autre_accountname']
            in group.members) and (test_config['accountname']
                                   not in group.members)
コード例 #2
0
def test_updateGroupSenders_cas_Normal(test_config):
    GroupService.updateGroupSenders(test_config['groupname'],
                                    test_config['autre_accountname'])
    group = GroupService.getGroup(test_config['groupname'], full_info=True)
    assert (test_config['autre_accountname']
            in group.senders) and (test_config['accountname']
                                   not in group.senders)
コード例 #3
0
def test_updateGroupAliases_cas_Normal(test_config):
    GroupService.updateGroupAliases(test_config['groupname'],
                                    test_config['autre_groupalias'])
    group = GroupService.getGroup(test_config['groupname'])
    assert (test_config['autre_groupalias']
            in group.aliases) and (test_config['groupalias']
                                   not in group.aliases)
コード例 #4
0
def test_addGroupAliases_cas_groupe_existant(test_config):
    with pytest.raises(ServiceException):
        GroupService.addGroupAliases(test_config['groupname'],
                                     test_config['groupalias'])
コード例 #5
0
def test_addGroupAliases_cas_Normal(test_config):
    GroupService.addGroupAliases(test_config['groupname'],
                                 test_config['groupalias'])
    group = GroupService.getGroup(test_config['groupname'])
    assert test_config['groupalias'] in group.aliases
コード例 #6
0
def test_getGroup_cas_groupe_inexistant(test_config):
    group = GroupService.getGroup("inexistant" + '@' +
                                  test_config['bss_domain'])
    assert group == None
コード例 #7
0
def test_getGroup_cas_normal(test_config):
    group = GroupService.getGroup(test_config['groupname'])
    assert group.name == test_config['groupname']
コード例 #8
0
def test_createGroup_cas_groupeExistant(test_config):
    with pytest.raises(ServiceException):
        newGroup = GroupService.createGroup(test_config['groupname'])
コード例 #9
0
def test_addGroupMember_cas_Normal(test_config):
    GroupService.addGroupMembers(test_config['groupname'],
                                 test_config['accountname'])
    group = GroupService.getGroup(test_config['groupname'])
    assert (test_config['accountname'] in group.members)
コード例 #10
0
def test_updateGroupAliases_cas_domaine_incorrect(test_config):
    with pytest.raises(ServiceException):
        GroupService.updateGroupAliases(
            test_config['groupname'],
            "*****@*****.**")
コード例 #11
0
def test_removeGroupSenders_cas_alias_inconnu(test_config):
    with pytest.raises(ServiceException):
        GroupService.removeGroupSenders(test_config['groupname'],
                                        test_config['autre_accountname'])
コード例 #12
0
def test_removeGroupSenders_cas_Normal(test_config):
    GroupService.removeGroupSenders(test_config['groupname'],
                                    test_config['autre_accountname'])
    group = GroupService.getGroup(test_config['groupname'])
    assert test_config['autre_accountname'] not in group.senders
コード例 #13
0
def delete_group(name):
    group = GroupService.getGroup(name)
    if group != None:
        GroupService.deleteGroup(name)
コード例 #14
0
def test_addGroupSenders_cas_compte_inconnu(test_config):
    with pytest.raises(NotFoundException):
        GroupService.addGroupSenders(
            test_config['groupname'],
            "inexistant" + '@' + test_config['bss_domain'])
コード例 #15
0
def test_addGroupSenders_cas_Normal(test_config):
    GroupService.addGroupSenders(test_config['groupname'],
                                 test_config['accountname'])
    group = GroupService.getGroup(test_config['groupname'], full_info=True)
    assert (test_config['accountname'] in group.senders)
コード例 #16
0
def test_deleteGroup_cas_normal(test_config):
    newGroup = GroupService.deleteGroup(test_config['groupname'])
    group = GroupService.getGroup(test_config['groupname'])
    assert group == None
コード例 #17
0
def test_removeGroupAliases_cas_Normal(test_config):
    GroupService.removeGroupAliases(test_config['groupname'],
                                    test_config['autre_groupalias'])
    group = GroupService.getGroup(test_config['groupname'], full_info=True)
    assert test_config['autre_groupalias'] not in group.aliases
コード例 #18
0
def test_createGroup_cas_normal(test_config):
    newGroup = GroupService.createGroup(test_config['groupname'])
    group = GroupService.getGroup(test_config['groupname'])
    assert group.name == test_config['groupname']
コード例 #19
0
def test_removeGroupAliases_cas_alias_inconnu(test_config):
    with pytest.raises(ServiceException):
        GroupService.removeGroupAliases(test_config['groupname'],
                                        test_config['autre_groupalias'])
コード例 #20
0
        count = DomainService.countObjects(args['domain'], args['type'])
    except Exception as err:
        print("Echec d'exécution : %s" % err)
        sys.exit(2)

    print("Nombre d'objets de type %s dans le domaine %s : %s" %
          (args['type'], args['domain'], count))

elif args['getAllGroups']:
    data = {
        'domain': args['domain'],
        'limit': args['limit'],
    }

    try:
        all_groups = GroupService.getAllGroups(**data)
    except Exception as err:
        print("Echec d'exécution : {}".format(repr(err)))
        sys.exit(2)

    print("{} groupes retournés".format(len(all_groups)))
    if 'fullData' in args and args['fullData']:
        print('Récupération des informations complètes...')
        try:
            all_groups = [
                GroupService.getGroup(g.name, full_info=True)
                for g in all_groups
            ]
        except Exception as err:
            print("Echec d'exécution : {}".format(repr(err)))
            sys.exit(2)