Skip to content

Commit

Permalink
document changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jokiefer committed Nov 7, 2024
1 parent e9e2494 commit 64215a3
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
],
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


[0.4.0] - 2024-11-07
--------------------

Added
~~~~~

* local identity (lid) handling


[0.3.2] - 2024-10-25
--------------------

Expand Down
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ Implemented Features
* `Updating To-One Relationships <https://jsonapi.org/ext/atomic/#auto-id-updating-to-one-relationships>`_
* `Updating To-Many Relationships <https://jsonapi.org/ext/atomic/#auto-id-updating-to-many-relationships>`_
* error reporting with json pointer to the concrete operation and the wrong attributes

* `local identity (lid) <https://jsonapi.org/ext/atomic/#operation-objects>`_ handling

ToDo
~~~~

Only one major feature need to be implemented for first major version v1.0.0:

* permission handling
* `local identity (lid) <https://jsonapi.org/ext/atomic/#operation-objects>`_ handling
2 changes: 1 addition & 1 deletion atomic_operations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.3.2"
__version__ = "0.4.0"
VERSION = __version__ # synonym
1 change: 1 addition & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os


SECRET_KEY = "SOME_SUPER_SECRET"

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def test_primary_data_with_id_and_lid(self):
"title": "JSON API paints my bikeshed!"
}
},
{
{
"op": "update",
"data": {
"lid": "1",
Expand All @@ -456,4 +456,4 @@ def test_primary_data_with_id_and_lid(self):
"stream": stream,
"parser_context": self.parser_context
}
)
)
22 changes: 10 additions & 12 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def setUp(self):

def test_content_type_extension(self):
"""Test that the correct content type is accepted
The media type and parameters are defined at https://jsonapi.org/ext/atomic. This tests
hardcodes the value to separate the test from the library's constants.
"""
operations = []

Expand Down Expand Up @@ -538,7 +538,7 @@ def test_view_processing_with_lid_substitution(self):
"text": "JSON API paints my bikeshed!"
}
}
},
},
{
"op": "add",
"data": {
Expand All @@ -548,7 +548,7 @@ def test_view_processing_with_lid_substitution(self):
"text": "JSON API paints my bikeshed!"
}
}
},{
}, {
"op": "update",
"data": {
"lid": "valid-lid-1",
Expand Down Expand Up @@ -675,7 +675,6 @@ def test_view_processing_with_lid_substitution(self):

self.assertDictEqual(expected_result,
json.loads(response.content))


# check db content
self.assertEqual(1, BasicModel.objects.count())
Expand All @@ -693,7 +692,6 @@ def test_view_processing_with_lid_substitution(self):
# with django 4.2 TransactionTestCase.assertQuerysetEqual() is deprecated in favor of assertQuerySetEqual().
self.assertQuerySetEqual(RelatedModelTwo.objects.filter(pk__in=[1, 2]),
BasicModel.objects.get(pk=2).to_many.all())


def test_view_processing_with_invalid_lid(self):
operations = [
Expand Down Expand Up @@ -735,7 +733,7 @@ def test_view_processing_with_invalid_lid(self):
error = json.loads(response.content)
expected_error = {
"errors": [
{
{
"id": "unknown-lid",
"detail": f'Object with lid `invalid-lid-test-2` received for operation with index `1` does not exist',
"source": {
Expand Down Expand Up @@ -797,7 +795,7 @@ def test_view_processing_with_lid_type_mismatch(self):
error = json.loads(response.content)
expected_error = {
"errors": [
{
{
"id": "unknown-lid",
"detail": f'Object with lid `lid-type-mismatch-1` received for operation with index `2` does not exist',
"source": {
Expand All @@ -821,7 +819,7 @@ def test_adding_resource_with_lid_relationship(self):
"text": "JSON API paints my bikeshed!"
}
},
},
},
{
"op": "add",
"data": {
Expand All @@ -841,7 +839,7 @@ def test_adding_resource_with_lid_relationship(self):
"text": "JSON API paints my bikeshed!"
}
},
},{
}, {
"op": "add",
"data": {
"type": "BasicModel",
Expand Down Expand Up @@ -869,7 +867,7 @@ def test_adding_resource_with_lid_relationship(self):
}
}
}
},
},
]

data = {
Expand Down Expand Up @@ -948,4 +946,4 @@ def test_adding_resource_with_lid_relationship(self):
}

self.assertDictEqual(expected_result,
json.loads(response.content))
json.loads(response.content))

0 comments on commit 64215a3

Please sign in to comment.