Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge v0.13.2 release #1290

Merged
merged 10 commits into from
Sep 21, 2023
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/release_cleanup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Release Cleanup
about: Minor tasks and checklist for maintainer to cleanup and prepare a release
title: 'Cleanup and prepare RELEASE_VERSION'
labels: documentation, internal
assignees: 'mikkonie'

---

## Minor Tasks

TBA

## Issues to add to CHANGELOG

TBA

## Release Checklist

- [ ] Review code style and cleanup if needed
- [ ] Review and update doc entries if needed
- [ ] Ensure all relevant updates are in `CHANGELOG` and major changes doc
- [ ] Ensure new version is in `CORE_API_ALLOWED_VERSIONS`
- [ ] Upgrade version number of pypi package references in `README` and docs
- [ ] Upgrade docs config version number (usually at `x.y.z-WIP` when developing)
- [ ] Update latest version info in `codemeta.json`
- [ ] Update version number and date in `CHANGELOG`
- [ ] Update version number and date in `Major Changes` doc
- [ ] Ensure docs can be built without errors

## Notes

N/A
34 changes: 34 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,40 @@ Changelog for the **SODAR Core** Django app package. Loosely follows the
`Keep a Changelog <http://keepachangelog.com/en/1.0.0/>`_ guidelines.


v0.13.2 (2023-09-21)
====================

Added
-----

- **General**
- Release cleanup issue template (#1289)
- Use ``sodar-btn-submit-once`` in object create forms (#1233)
- **Projectroles**
- ``queryset_project_field`` override in ``APIProjectContextMixin`` (#1273)
- ``sodar-btn-submit-once`` class for forms (#1233)

Changed
-------

- **General**
- Refactor and cleanup permission tests (#1267)
- Enable setting ``ADMINS`` Django setting via env (#1280)
- **Timeline**
- Update column width and responsiveness handling (#1721)
- View icon display for site views (#1720)

Fixed
-----

- **Projectroles**
- User account update signals not triggered on login (#1274)
- Project list rendering failure with finder role (#1276)
- Crash in ``email`` module with empty ``ADMINS`` setting (#1287)
- **Timeline**
- Ajax view permission test issues (#1267)


v0.13.1 (2023-08-30)
====================

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ and breaking changes are possible.

.. code-block:: console

pip install django-sodar-core==0.13.1
pip install django-sodar-core==0.13.2

For installing a development version you can point your dependency to a specific
commit ID in GitHub. Note that these versions may not be stable.
Expand Down
142 changes: 83 additions & 59 deletions adminalerts/tests/test_permissions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Permission tests for the adminalerts app"""
"""Test for UI view permissions in the adminalerts app"""

from django.test import override_settings
from django.urls import reverse
Expand All @@ -9,8 +9,8 @@
from adminalerts.tests.test_models import AdminAlertMixin


class TestAdminAlertPermissions(AdminAlertMixin, TestSiteAppPermissionBase):
"""Tests for AdminAlert permissions"""
class AdminalertsPermissionTestBase(AdminAlertMixin, TestSiteAppPermissionBase):
"""Base test class for adminalerts UI view permission tests"""

def setUp(self):
super().setUp()
Expand All @@ -22,99 +22,123 @@ def setUp(self):
active=True,
)

def test_alert_list(self):
"""Test permissions for AdminAlert list"""
url = reverse('adminalerts:list')

class TestAdminAlertListView(AdminalertsPermissionTestBase):
"""Permission tests for AdminAlertListView"""

def setUp(self):
super().setUp()
self.url = reverse('adminalerts:list')

def test_get(self):
"""Test AdminAlertListView GET"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

@override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True)
def test_alert_list_anon(self):
"""Test permissions for AdminAlert list with anonymous access"""
url = reverse('adminalerts:list')
def test_get_anon(self):
"""Test GET with anonymous access"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)


def test_alert_detail(self):
"""Test permissions for AdminAlert details"""
url = reverse(
class TestAdminAlertDetailView(AdminalertsPermissionTestBase):
"""Permission tests for dminAlertDetailView"""

def setUp(self):
super().setUp()
self.url = reverse(
'adminalerts:detail', kwargs={'adminalert': self.alert.sodar_uuid}
)

def test_get(self):
"""Test AdminAlertDetailView GET"""
good_users = [self.superuser, self.regular_user]
bad_users = [self.anonymous]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

@override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True)
def test_alert_detail_anon(self):
"""Test permissions for AdminAlert details with anonymous access"""
url = reverse(
'adminalerts:detail', kwargs={'adminalert': self.alert.sodar_uuid}
)
def test_get_anon(self):
"""Test GET with anonymous access"""
good_users = [self.superuser, self.regular_user]
bad_users = [self.anonymous]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

def test_alert_create(self):
"""Test permissions for AdminAlert creation"""
url = reverse('adminalerts:create')

class TestAdminAlertCreateView(AdminalertsPermissionTestBase):
"""Permission tests for AdminAlertCreateView"""

def setUp(self):
super().setUp()
self.url = reverse('adminalerts:create')

def test_get(self):
"""Test AdminAlertCreateView GET"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

@override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True)
def test_alert_create_anon(self):
"""Test permissions for AdminAlert creation with anonymous access"""
url = reverse('adminalerts:create')
def test_get_anon(self):
"""Test GET with anonymous access"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)


def test_alert_update(self):
"""Test permissions for AdminAlert updating"""
url = reverse(
class TestAdminAlertUpdateView(AdminalertsPermissionTestBase):
"""Permission tests for AdminAlertUpdateView"""

def setUp(self):
super().setUp()
self.url = reverse(
'adminalerts:update', kwargs={'adminalert': self.alert.sodar_uuid}
)

def test_get(self):
"""Test AdminAlertUpdateView GET"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

@override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True)
def test_alert_update_anon(self):
"""Test permissions for AdminAlert updating with anonymous access"""
url = reverse(
'adminalerts:update', kwargs={'adminalert': self.alert.sodar_uuid}
)
def test_get_anon(self):
"""Test GET with anonymous access"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

def test_alert_delete(self):
"""Test permissions for AdminAlert deletion"""
url = reverse(

class TestAdminAlertDeleteView(AdminalertsPermissionTestBase):
"""Permission tests for AdminAlertDeleteView"""

def setUp(self):
super().setUp()
self.url = reverse(
'adminalerts:delete', kwargs={'adminalert': self.alert.sodar_uuid}
)

def test_get(self):
"""Test AdminAlertDeleteView GET"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)

@override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True)
def test_alert_delete_anon(self):
"""Test permissions for AdminAlert deletion with anonymous access"""
url = reverse(
'adminalerts:delete', kwargs={'adminalert': self.alert.sodar_uuid}
)
def test_get_anon(self):
"""Test GET with anonymous access"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200)
self.assert_response(url, bad_users, 302)
self.assert_response(self.url, good_users, 200)
self.assert_response(self.url, bad_users, 302)
28 changes: 13 additions & 15 deletions adminalerts/tests/test_permissions_ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
from adminalerts.tests.test_models import AdminAlertMixin


class TestAdminAlertPermissions(AdminAlertMixin, TestSiteAppPermissionBase):
"""Tests for AdminAlert views"""
class TestAdminAlertActiveToggleAjaxView(
AdminAlertMixin, TestSiteAppPermissionBase
):
"""Permission tests for AdminAlertActiveToggleAjaxView"""

def setUp(self):
super().setUp()
Expand All @@ -21,23 +23,19 @@ def setUp(self):
description='description',
active=True,
)

def test_active_toggle(self):
"""Test permissions for activation Ajax view"""
url = reverse(
self.url = reverse(
'adminalerts:ajax_active_toggle',
kwargs={'adminalert': self.alert.sodar_uuid},
)

def test_post(self):
"""Test AdminAlertActiveToggleAjaxView POST"""
good_users = [self.superuser]
bad_users = [self.anonymous, self.regular_user]
self.assert_response(url, good_users, 200, method='POST')
self.assert_response(url, bad_users, 403, method='POST')
self.assert_response(self.url, good_users, 200, method='POST')
self.assert_response(self.url, bad_users, 403, method='POST')

@override_settings(PROJECTROLES_ALLOW_ANONYMOUS=True)
def test_active_toggle_anon(self):
"""Test permissions for activation Ajax view with anonymous access"""
url = reverse(
'adminalerts:ajax_active_toggle',
kwargs={'adminalert': self.alert.sodar_uuid},
)
self.assert_response(url, self.anonymous, 403, method='POST')
def test_post_anon(self):
"""Test POST with anonymous access"""
self.assert_response(self.url, self.anonymous, 403, method='POST')
Loading