-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from UW-GAC/main
Deploying acm v0.13
- Loading branch information
Showing
13 changed files
with
146 additions
and
31 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
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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import django_tables2 as tables | ||
from django.contrib.auth import get_user_model | ||
|
||
User = get_user_model() | ||
|
||
|
||
class UserTable(tables.Table): | ||
"""A table for `User`s.""" | ||
|
||
username = tables.columns.Column(linkify=True) | ||
research_centers = tables.columns.ManyToManyColumn(linkify_item=True) | ||
|
||
class Meta: | ||
model = User | ||
fields = ("username", "name", "email", "research_centers") |
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 |
---|---|---|
|
@@ -109,6 +109,14 @@ def test_update_research_centers_malformed(self): | |
user, dict(research_center_or_site="FOO") | ||
) | ||
|
||
def test_update_user_research_centers_uknown(self): | ||
adapter = SocialAccountAdapter() | ||
user = UserFactory() | ||
adapter.update_user_research_centers( | ||
user, dict(research_center_or_site=["UNKNOWN"]) | ||
) | ||
assert user.research_centers.all().count() == 0 | ||
|
||
def test_update_user_groups_add(self): | ||
adapter = SocialAccountAdapter() | ||
rc1 = GroupFactory(name="g1") | ||
|
@@ -126,6 +134,22 @@ def test_update_user_groups_add(self): | |
assert user.groups.filter(pk=rc1.pk).exists() | ||
assert user.groups.all().count() == 1 | ||
|
||
def test_update_user_groups_create(self): | ||
adapter = SocialAccountAdapter() | ||
|
||
User = get_user_model() | ||
user = User() | ||
setattr(user, account_settings.USER_MODEL_USERNAME_FIELD, "test") | ||
setattr(user, account_settings.USER_MODEL_EMAIL_FIELD, "[email protected]") | ||
|
||
user.save() | ||
|
||
adapter.update_user_groups( | ||
user, extra_data=dict(managed_scope_status={"CREATE_GROUP": True}) | ||
) | ||
assert user.groups.filter(name="CREATE_GROUP").exists() | ||
assert user.groups.all().count() == 1 | ||
|
||
def test_update_user_groups_remove(self): | ||
adapter = SocialAccountAdapter() | ||
rc1 = GroupFactory(name="g1") | ||
|
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