Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Delaunay committed Jul 12, 2023
1 parent e30572d commit 7b158ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions sarc/ldap/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MultipleSupervisor(Exception):
pass


def extract_supervisors(member_of):
def extract_groups(member_of):
supervisors = []
groups = []
is_student = False
Expand Down Expand Up @@ -80,7 +80,7 @@ def _student_or_prof(person, S_profs, exceptions):
university,
is_student,
is_core,
) = extract_supervisors(person["memberOf"])
) = extract_groups(person["memberOf"])

if person["suspended"][0] == "true":
return None
Expand Down Expand Up @@ -227,8 +227,6 @@ def resolve_supervisors(ldap_people, group_to_prof, exceptions):
person, group_to_prof, errors, index
)

print(supervisors)

if len(supervisors) == 0:
person.ldap["supervisor"] = []
errors.no_supervisors.append(person)
Expand Down
18 changes: 9 additions & 9 deletions tests/unittests/ldap/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import sarc.ldap.read_mila_ldap
from sarc.ldap.read_mila_ldap import resolve_supervisors, run
from sarc.ldap.supervisor import _student_or_prof, extract_supervisors
from sarc.ldap.supervisor import _student_or_prof, extract_groups


class CollectionMock:
Expand Down Expand Up @@ -112,8 +112,8 @@ def ldap_exception(*args):
return {}


def test_extract_supervisors_student_no_supervisor():
supervisors, groups, university, is_student, is_core = extract_supervisors(
def test_extract_groups_student_no_supervisor():
supervisors, groups, university, is_student, is_core = extract_groups(
make_student("ok", ["mcgill"])["memberOf"]
)

Expand All @@ -126,10 +126,10 @@ def test_extract_supervisors_student_no_supervisor():
assert groups == []


def test_extract_supervisors_student():
def test_extract_groups_student():
ldap_people = ldap_mock()

supervisors, groups, university, is_student, is_core = extract_supervisors(
supervisors, groups, university, is_student, is_core = extract_groups(
ldap_people[0]["memberOf"]
)

Expand All @@ -142,10 +142,10 @@ def test_extract_supervisors_student():
assert groups == []


def test_extract_supervisors_not_core():
def test_extract_groups_not_core():
ldap_people = ldap_mock()

supervisors, groups, university, is_student, is_core = extract_supervisors(
supervisors, groups, university, is_student, is_core = extract_groups(
ldap_people[1]["memberOf"]
)

Expand All @@ -158,10 +158,10 @@ def test_extract_supervisors_not_core():
assert groups == []


def test_extract_supervisors():
def test_extract_groups():
ldap_people = ldap_mock()

supervisors, groups, university, is_student, is_core = extract_supervisors(
supervisors, groups, university, is_student, is_core = extract_groups(
ldap_people[2]["memberOf"]
)

Expand Down

0 comments on commit 7b158ce

Please sign in to comment.