-
Notifications
You must be signed in to change notification settings - Fork 286
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 #51 from farridav/farridav/add_missing_tests
Adds missing tests
- Loading branch information
Showing
11 changed files
with
278 additions
and
97 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
version = '2.0.1' | ||
version = '2.1.1' | ||
default_app_config = 'jazzmin.apps.JazzminConfig' |
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 |
---|---|---|
@@ -1,41 +1,64 @@ | ||
import pytest | ||
from django.urls import reverse | ||
|
||
from tests.test_app.polls.models import Poll | ||
from tests.utils import user_with_permissions, parse_sidemenu | ||
|
||
@pytest.mark.skip | ||
def test_no_delete_permission(): | ||
|
||
@pytest.mark.django_db | ||
def test_no_delete_permission(client): | ||
""" | ||
When our user has no delete permission, they dont see things they are not supposed to | ||
""" | ||
pass | ||
user = user_with_permissions('polls.view_poll') | ||
poll = Poll.objects.create(owner=user, text='question') | ||
|
||
url = reverse('admin:polls_poll_change', args=(poll.pk,)) | ||
delete_url = reverse('admin:polls_poll_delete', args=(poll.pk,)) | ||
client.force_login(user) | ||
|
||
response = client.get(url) | ||
assert delete_url not in response.content.decode() | ||
|
||
|
||
@pytest.mark.skip | ||
def test_no_add_permission(): | ||
@pytest.mark.django_db | ||
def test_no_add_permission(client): | ||
""" | ||
When our user has no add permission, they dont see things they are not supposed to | ||
""" | ||
pass | ||
user = user_with_permissions('polls.view_poll') | ||
url = reverse('admin:polls_poll_changelist') | ||
add_url = reverse('admin:polls_poll_add') | ||
|
||
client.force_login(user) | ||
response = client.get(url) | ||
|
||
@pytest.mark.skip | ||
def test_no_change_permission(): | ||
""" | ||
When our user has no change permission, they dont see things they are not supposed to | ||
""" | ||
pass | ||
assert add_url not in response.content.decode() | ||
|
||
|
||
@pytest.mark.skip | ||
def test_no_view_permission(): | ||
@pytest.mark.django_db | ||
def test_no_view_permission(client): | ||
""" | ||
When our user has no view permission, they dont see things they are not supposed to | ||
""" | ||
pass | ||
user = user_with_permissions('polls.change_poll') | ||
|
||
url = reverse('admin:index') | ||
client.force_login(user) | ||
|
||
@pytest.mark.skip | ||
def test_no_permission(): | ||
response = client.get(url) | ||
assert parse_sidemenu(response) == {'Global': ['/admin/']} | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_no_permission(client): | ||
""" | ||
When our user has no permissions at all, they see no menu or dashboard | ||
""" | ||
pass | ||
user = user_with_permissions() | ||
|
||
url = reverse('admin:index') | ||
client.force_login(user) | ||
|
||
response = client.get(url) | ||
assert parse_sidemenu(response) == {'Global': ['/admin/']} |
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.