Skip to content

Commit

Permalink
⬆️ Support Django 3.1 (#180)
Browse files Browse the repository at this point in the history
⬆️ Support Django 3.1
  • Loading branch information
simkimsia authored Jan 2, 2021
1 parent 57fdcc1 commit 06a23df
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ dist
.pytest_cache
.python-version
build
venv*
venv*
.vscode/settings.json
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ matrix:
env: TOXENV=py36-dj2.2-sqlite3
- python: "3.6"
env: TOXENV=py36-dj3.0-sqlite3
- python: "3.6"
env: TOXENV=py36-dj3.1-sqlite3
- python: "3.6"
env: TOXENV=cov
- python: "3.6"
Expand Down Expand Up @@ -65,4 +67,4 @@ install:
script:
- tox
after_success:
- coveralls
- coveralls
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. |Build Status| image:: https://travis-ci.org/javrasya/django-river.svg
:target: https://travis-ci.org/javrasya/django-river

.. |Coverage Status| image:: https://coveralls.io/repos/javrasya/django-river/badge.svg?branch=master&service=github
:target: https://coveralls.io/github/javrasya/django-river?branch=master

Expand All @@ -10,21 +10,21 @@

.. |Documentation Status| image:: https://readthedocs.org/projects/django-river/badge/?version=latest
:target: https://readthedocs.org/projects/django-river/?badge=latest

.. |Quality Status| image:: https://api.codacy.com/project/badge/Grade/c3c73d157fe045e6b966d8d4416b6b17
:alt: Codacy Badge
:target: https://app.codacy.com/app/javrasya/django-river?utm_source=github.com&utm_medium=referral&utm_content=javrasya/django-river&utm_campaign=Badge_Grade_Dashboard

.. |Downloads| image:: https://img.shields.io/pypi/dm/django-river
:alt: PyPI - Downloads

.. |Discord| image:: https://img.shields.io/discord/651433240019599400
:target: https://discord.gg/DweUwZX
:alt: Discord
:alt: Discord

.. |Open Collective| image:: https://opencollective.com/django-river/all/badge.svg?label=financial+contributors
:alt: Financial Contributors
:target: #contributors
:target: #contributors

.. |Timeline| image:: https://cloud.githubusercontent.com/assets/1279644/9934893/921b543a-5d5c-11e5-9596-a5e067db79ed.png

Expand Down Expand Up @@ -77,7 +77,7 @@ A very modern admin with some user friendly interfaces that is called `River Adm
Requirements
------------
* Python (``2.7``, ``3.5``, ``3.6``)
* Django (``1.11``, ``2.0``, ``2.1``, ``2.2``, ``3.0``)
* Django (``1.11``, ``2.0``, ``2.1``, ``2.2``, ``3.0``, ``3.1``)
* ``Django`` >= 2.0 is supported for ``Python`` >= 3.5

Supported (Tested) Databases:
Expand Down
4 changes: 2 additions & 2 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ There is ordering aprovments for a transition functionality in ``django-river``.
Requirements
------------
* Python (``2.7``, ``3.5``, ``3.6``)
* Django (``1.11``, ``2.0``, ``2.1``, ``2.2``, ``3.0``)
* Django (``1.11``, ``2.0``, ``2.1``, ``2.2``, ``3.0``, ``3.1``)
* ``Django`` >= 2.0 is supported for ``Python`` >= 3.5


Expand Down Expand Up @@ -67,4 +67,4 @@ Closed without Re-Open case

Closed with Re-Open case
""""""""""""""""""""""""
|Closed With Re Open Case|
|Closed With Re Open Case|
36 changes: 18 additions & 18 deletions river/tests/models/test__transition_approval.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
from django.contrib.contenttypes.models import ContentType
from django.db.models import ProtectedError
from django.test import TestCase
from hamcrest import assert_that, has_length, calling, raises

from river.models import TransitionApproval, APPROVED
from river.models.factories import WorkflowFactory, StateObjectFactory, TransitionApprovalMetaFactory, TransitionMetaFactory
from hamcrest import assert_that, calling, raises
from river.models import APPROVED, TransitionApproval
from river.models.factories import StateObjectFactory, TransitionApprovalMetaFactory, TransitionMetaFactory, WorkflowFactory
from river.tests.models import BasicTestModel
from river.tests.models.factories import BasicTestModelObjectFactory

# noinspection PyMethodMayBeStatic,DuplicatedCode
from rivertest.flowbuilder import RawState, FlowBuilder
from rivertest.flowbuilder import FlowBuilder, RawState


class TransitionApprovalModelTest(TestCase):

def test_shouldNotAllowWorkflowToBeDeletedWhenThereIsATransitionApproval(self):
content_type = ContentType.objects.get_for_model(BasicTestModel)

state1 = RawState("state_1")
state2 = RawState("state_2")

authorization_policies = []
flow = FlowBuilder("my_field", content_type) \
.with_transition(state1, state2, authorization_policies) \
.build()
flow = FlowBuilder("my_field", content_type).with_transition(state1, state2, authorization_policies).build()

assert_that(
calling(flow.workflow.delete),
raises(ProtectedError, "Cannot delete some instances of model 'Workflow' because they are referenced through a protected foreign key")
raises(ProtectedError, "Cannot delete some instances of model 'Workflow' because they are referenced through .*")
)

def test_shouldNotAllowTheStateToBeDeletedWhenThereIsATransitionApprovalThatIsUsedAsSource(self):
Expand All @@ -38,14 +34,16 @@ def test_shouldNotAllowTheStateToBeDeletedWhenThereIsATransitionApprovalThatIsUs
state3 = RawState("state_3")

authorization_policies = []
flow = FlowBuilder("my_field", content_type) \
.with_transition(state1, state2, authorization_policies) \
.with_transition(state2, state3, authorization_policies) \
flow = (
FlowBuilder("my_field", content_type)
.with_transition(state1, state2, authorization_policies)
.with_transition(state2, state3, authorization_policies)
.build()
)

assert_that(
calling(flow.get_state(state2).delete),
raises(ProtectedError, "Cannot delete some instances of model 'State' because they are referenced through a protected foreign key")
raises(ProtectedError, "Cannot delete some instances of model 'State' because they are referenced through .*")
)

def test_shouldNotAllowTheStateToBeDeletedWhenThereIsATransitionApprovalThatIsUsedAsDestination(self):
Expand All @@ -56,12 +54,14 @@ def test_shouldNotAllowTheStateToBeDeletedWhenThereIsATransitionApprovalThatIsUs
state3 = RawState("state_3")

authorization_policies = []
flow = FlowBuilder("my_field", content_type) \
.with_transition(state1, state2, authorization_policies) \
.with_transition(state2, state3, authorization_policies) \
flow = (
FlowBuilder("my_field", content_type)
.with_transition(state1, state2, authorization_policies)
.with_transition(state2, state3, authorization_policies)
.build()
)

assert_that(
calling(flow.get_state(state3).delete),
raises(ProtectedError, "Cannot delete some instances of model 'State' because they are referenced through a protected foreign key")
raises(ProtectedError, "Cannot delete some instances of model 'State' because they are referenced through .*")
)
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
envlist = {py27}-{dj1.11}-{sqlite3},
{py35}-{dj1.11,dj2.0,dj2.1,dj2.2}-{sqlite3},
{py36}-{dj1.11,dj2.0,dj2.1,dj2.2,dj3.0}-{sqlite3},
{py36}-{dj1.11,dj2.0,dj2.1,dj2.2,dj3.1}-{sqlite3},
{py36}-{dj2.2}-{postgresql9,postgresql10,postgresql11,postgresql12},
{py36}-{dj2.2}-{mysql8.0},
{py36}-{dj2.2}-{msqsql17,mssql19},
Expand Down Expand Up @@ -41,6 +42,7 @@ deps =
dj2.1: Django>=2.1,<2.2.0
dj2.2: Django>=2.2,<2.3.0
dj3.0: Django>=3.0,<3.1.0
dj3.1: Django>=3.1,<3.2.0
postgresql9,postgresql10,postgresql11,postgresql12: psycopg2
mysql8.0: mysqlclient
mssql17,mssql19: django-mssql-backend
Expand Down

0 comments on commit 06a23df

Please sign in to comment.