-
Notifications
You must be signed in to change notification settings - Fork 49
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 #681 from rdmorganiser/dev-2.0.0+cleanup
Dev 2.0.0+cleanup
- Loading branch information
Showing
266 changed files
with
1,570 additions
and
1,234 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,4 @@ Please state your operating system, the RDMO version, and (if applicable) the br | |
|
||
### References / Verweise | ||
|
||
* | ||
* |
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
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
from django.urls import reverse | ||
|
||
|
||
roles = ('member', 'manager', 'editor', 'reviewer') | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import pytest | ||
|
||
from django.contrib.auth import get_user_model | ||
from django.contrib.auth.models import AnonymousUser | ||
|
||
from rdmo.accounts.models import Role | ||
from rdmo.accounts.utils import get_full_name, is_site_manager, delete_user, get_user_from_db_or_none | ||
|
||
from rdmo.accounts.utils import delete_user, get_full_name, get_user_from_db_or_none, is_site_manager | ||
|
||
normal_users = ( | ||
('user', 'user', '[email protected]'), | ||
|
@@ -55,42 +55,41 @@ def test_is_site_manager_returns_false_when_role_doesnotexist_(db, client, usern | |
|
||
|
||
@pytest.mark.parametrize('username,password,email', users) | ||
def test_delete_user_returns_true(db, username, password, email): | ||
def test_delete_user(db, username, password, email): | ||
user = get_user_model().objects.get(username=username, email=email) | ||
assert delete_user(user=user, email=email, password=password) is True | ||
|
||
|
||
@pytest.mark.parametrize('username,password,email', users) | ||
def test_delete_user_returns_false_when_user_or_email_is_none(db, username, password, email): | ||
def test_delete_user_when_user_or_email_is_none(db, username, password, email): | ||
user = get_user_model().objects.get(username=username, email=email) | ||
for test_user, test_email in ((user, None), (None, email), (None, None)): | ||
assert delete_user(user=test_user, email=test_email) is False | ||
|
||
|
||
@pytest.mark.parametrize('username,password,email', users) | ||
def test_delete_user_returns_false_when_user_is_not_equal_to_db_user(db, username, password, email): | ||
def test_delete_user_when_user_is_not_equal_to_db_user(db, username, password, email): | ||
user = get_user_model().objects.get(username=username, email=email) | ||
user.pk += 1 | ||
assert delete_user(user=user, email=email, password=None) is False | ||
|
||
|
||
|
||
@pytest.mark.parametrize('username,password,email', users) | ||
def test_delete_user_returns_false_when_user_with_usable_password_gives_none_for_password(db, username, password, email): | ||
def test_delete_user_when_user_with_usable_password_gives_none_for_password(db, username, password, email): | ||
user = get_user_model().objects.get(username=username, email=email) | ||
assert delete_user(user=user, email=email, password=None) is False | ||
|
||
|
||
@pytest.mark.parametrize('username,password,email', users) | ||
def test_delete_user_returns_false_when_delete_user_raises_an_exception(db, username, password, email): | ||
def test_delete_user_when_delete_user_raises_an_exception(db, username, password, email): | ||
user = get_user_model().objects.get(username=username, email=email) | ||
def _delete(): raise ValueError | ||
user.delete = _delete | ||
assert delete_user(user=user, email=email, password=password) is False | ||
|
||
|
||
@pytest.mark.parametrize('username,password,email', users) | ||
def test_delete_user_returns_false_when_delete_is_called_for_user_without_usable_password_and_raises_an_exception(db, username, password, email): | ||
def test_delete_user_without_usable_password_and_raises_an_exception(db, username, password, email): | ||
user = get_user_model().objects.get(username=username, email=email) | ||
user.set_unusable_password() | ||
def _delete(): raise ValueError | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import pytest | ||
|
||
from django.contrib.auth import get_user_model | ||
from django.urls import reverse | ||
|
||
|
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.