-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b991e5
commit 9e1f2d8
Showing
6 changed files
with
277 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,14 +2,16 @@ | |
|
||
import pytest | ||
|
||
from guacamole_user_sync.models import LDAPGroup, LDAPQuery, LDAPSearchResult, LDAPUser | ||
from guacamole_user_sync.models import LDAPGroup, LDAPQuery, LDAPUser | ||
from guacamole_user_sync.postgresql.orm import ( | ||
GuacamoleEntity, | ||
GuacamoleEntityType, | ||
GuacamoleUser, | ||
GuacamoleUserGroup, | ||
) | ||
|
||
from .mocks import MockLDAPGroupEntry, MockLDAPUserEntry | ||
|
||
|
||
@pytest.fixture | ||
def ldap_model_groups_fixture() -> list[LDAPGroup]: | ||
|
@@ -69,70 +71,45 @@ def ldap_query_users_fixture() -> LDAPQuery: | |
|
||
|
||
@pytest.fixture | ||
def ldap_response_groups_fixture() -> LDAPSearchResult: | ||
def ldap_response_groups_fixture() -> list[MockLDAPGroupEntry]: | ||
return [ | ||
( | ||
0, | ||
( | ||
"CN=plaintiffs,OU=groups,DC=rome,DC=la", | ||
{ | ||
"cn": [b"plaintiffs"], | ||
"memberOf": [], | ||
"memberUid": [b"aulus.agerius"], | ||
}, | ||
), | ||
), | ||
( | ||
1, | ||
( | ||
"CN=defendants,OU=groups,DC=rome,DC=la", | ||
{ | ||
"cn": [b"defendants"], | ||
"memberOf": [], | ||
"memberUid": [b"numerius.negidius"], | ||
}, | ||
), | ||
), | ||
( | ||
2, | ||
( | ||
"CN=everyone,OU=groups,DC=rome,DC=la", | ||
{ | ||
"cn": [b"everyone"], | ||
"memberOf": [], | ||
"memberUid": [b"aulus.agerius", b"numerius.negidius"], | ||
}, | ||
), | ||
MockLDAPGroupEntry( | ||
dn="CN=plaintiffs,OU=groups,DC=rome,DC=la", | ||
cn="plaintiffs", | ||
memberOf=[], | ||
memberUid=["aulus.agerius"], | ||
), | ||
MockLDAPGroupEntry( | ||
dn="CN=defendants,OU=groups,DC=rome,DC=la", | ||
cn="defendants", | ||
memberOf=[], | ||
memberUid=["numerius.negidius"], | ||
), | ||
MockLDAPGroupEntry( | ||
dn="CN=everyone,OU=groups,DC=rome,DC=la", | ||
cn="everyone", | ||
memberOf=[], | ||
memberUid=["aulus.agerius", "numerius.negidius"], | ||
), | ||
] | ||
|
||
|
||
@pytest.fixture | ||
def ldap_response_users_fixture() -> LDAPSearchResult: | ||
def ldap_response_users_fixture() -> list[MockLDAPUserEntry]: | ||
return [ | ||
( | ||
0, | ||
( | ||
"CN=aulus.agerius,OU=users,DC=rome,DC=la", | ||
{ | ||
"displayName": [b"Aulus Agerius"], | ||
"memberOf": [b"CN=plaintiffs,OU=groups,DC=rome,DC=la"], | ||
"uid": [b"aulus.agerius"], | ||
"userName": [b"[email protected]"], | ||
}, | ||
), | ||
), | ||
( | ||
1, | ||
( | ||
"CN=numerius.negidius,OU=users,DC=rome,DC=la", | ||
{ | ||
"displayName": [b"Numerius Negidius"], | ||
"memberOf": [b"CN=defendants,OU=groups,DC=rome,DC=la"], | ||
"uid": [b"numerius.negidius"], | ||
"userName": [b"[email protected]"], | ||
}, | ||
), | ||
MockLDAPUserEntry( | ||
dn="CN=aulus.agerius,OU=users,DC=rome,DC=la", | ||
displayName="Aulus Agerius", | ||
memberOf=["CN=plaintiffs,OU=groups,DC=rome,DC=la"], | ||
uid="aulus.agerius", | ||
userName="[email protected]", | ||
), | ||
MockLDAPUserEntry( | ||
dn="CN=numerius.negidius,OU=users,DC=rome,DC=la", | ||
displayName="Numerius Negidius", | ||
memberOf=["CN=defendants,OU=groups,DC=rome,DC=la"], | ||
uid="numerius.negidius", | ||
userName="[email protected]", | ||
), | ||
] | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.