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)
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)
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)
def test_addGroupAliases_cas_groupe_existant(test_config): with pytest.raises(ServiceException): GroupService.addGroupAliases(test_config['groupname'], test_config['groupalias'])
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
def test_getGroup_cas_groupe_inexistant(test_config): group = GroupService.getGroup("inexistant" + '@' + test_config['bss_domain']) assert group == None
def test_getGroup_cas_normal(test_config): group = GroupService.getGroup(test_config['groupname']) assert group.name == test_config['groupname']
def test_createGroup_cas_groupeExistant(test_config): with pytest.raises(ServiceException): newGroup = GroupService.createGroup(test_config['groupname'])
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)
def test_updateGroupAliases_cas_domaine_incorrect(test_config): with pytest.raises(ServiceException): GroupService.updateGroupAliases( test_config['groupname'], "*****@*****.**")
def test_removeGroupSenders_cas_alias_inconnu(test_config): with pytest.raises(ServiceException): GroupService.removeGroupSenders(test_config['groupname'], test_config['autre_accountname'])
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
def delete_group(name): group = GroupService.getGroup(name) if group != None: GroupService.deleteGroup(name)
def test_addGroupSenders_cas_compte_inconnu(test_config): with pytest.raises(NotFoundException): GroupService.addGroupSenders( test_config['groupname'], "inexistant" + '@' + test_config['bss_domain'])
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)
def test_deleteGroup_cas_normal(test_config): newGroup = GroupService.deleteGroup(test_config['groupname']) group = GroupService.getGroup(test_config['groupname']) assert group == None
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
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']
def test_removeGroupAliases_cas_alias_inconnu(test_config): with pytest.raises(ServiceException): GroupService.removeGroupAliases(test_config['groupname'], test_config['autre_groupalias'])
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)