Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
## Content Management SDK For Python
---

## v1.2.0

#### Date: 08 July 2024

- Added testcases for creation of Roles with taxonomy permission.
---

## v1.1.1

#### Date: 21 May 2024
Expand Down
2 changes: 1 addition & 1 deletion contentstack_management/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
__author__ = 'ishaileshmishra'
__status__ = 'debug'
__region__ = 'na'
__version__ = '1.1.1'
__version__ = '1.2.0'
__host__ = 'api.contentstack.io'
__protocol__ = 'https://'
__api_version__ = 'v3'
Expand Down
59 changes: 59 additions & 0 deletions tests/api/roles/test_roles_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ def test_get_a_roles(self):
f"{self.client.endpoint}roles/{role_uid}")
self.assertEqual(response.status_code, 200)

def test_create_taxonomy(self):
data = {
"taxonomy": {
"uid": "taxonomy_testing1",
"name": "taxonomy_testing1",
"description": "Description for Taxonomy 1"
}
}
response = self.client.stack(api_key).taxonomy().create(data)
self.assertEqual(response.status_code, 201)

def test_create_terms(self):
data = {
"term": {
"uid": "term_test1",
"name": "term_test1",
"parent_uid": None
}
}
response = self.client.stack(api_key).taxonomy("taxonomy_1").terms().create(data)
self.assertEqual(response.status_code, 201)

def test_create(self):
data = {
Expand Down Expand Up @@ -106,6 +127,36 @@ def test_create(self):
"acl":{
"read":True
}
},
{
"module": "taxonomy",
"taxonomies": ["taxonomy_testing1"],
"terms": ["taxonomy_testing1.term_test1"],
"content_types": [
{
"uid": "$all",
"acl": {
"read": True,
"sub_acl": {
"read": True,
"create": True,
"update": True,
"delete": True,
"publish": True
}
}
}
],
"acl": {
"read": True,
"sub_acl": {
"read": True,
"create": True,
"update": True,
"delete": True,
"publish": True
}
}
}
]
}
Expand Down Expand Up @@ -207,6 +258,14 @@ def test_update_roles(self):
self.assertEqual(response.request.url,
f"{self.client.endpoint}roles/{role_uid}")
self.assertEqual(response.status_code, 200)

def test_delete(self):
response = self.client.stack(api_key).taxonomy("taxonomy_testing1").terms("term_test1").delete()
self.assertEqual(response.status_code, 200)

def test_delete_taxonomy(self):
response = self.client.stack(api_key).taxonomy("taxonomy_testing1").delete()
self.assertEqual(response.status_code, 200)


def test_delete_roles(self):
Expand Down
30 changes: 30 additions & 0 deletions tests/mock/roles/test_roles_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,36 @@ def test_create(self):
"acl":{
"read":True
}
},
{
"module": "taxonomy",
"taxonomies": ["taxonomy_testing1"],
"terms": ["taxonomy_testing1.term_test1"],
"content_types": [
{
"uid": "$all",
"acl": {
"read": True,
"sub_acl": {
"read": True,
"create": True,
"update": True,
"delete": True,
"publish": True
}
}
}
],
"acl": {
"read": True,
"sub_acl": {
"read": True,
"create": True,
"update": True,
"delete": True,
"publish": True
}
}
}
]
}
Expand Down
32 changes: 31 additions & 1 deletion tests/resources/mock_roles/create.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,37 @@
"acl": {
"read": true
}
}
},
{
"module": "taxonomy",
"taxonomies": ["taxonomy_testing1"],
"terms": ["taxonomy_testing1.term_test1"],
"content_types": [
{
"uid": "$all",
"acl": {
"read": true,
"sub_acl": {
"read": true,
"create": true,
"update": true,
"delete": true,
"publish": true
}
}
}
],
"acl": {
"read": true,
"sub_acl": {
"read": true,
"create": true,
"update": true,
"delete": true,
"publish": true
}
}
}
],
"users": [],
"uid": "role_uid",
Expand Down
30 changes: 30 additions & 0 deletions tests/unit/roles/test_roles_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,36 @@ def test_create(self):
"acl":{
"read":True
}
},
{
"module": "taxonomy",
"taxonomies": ["taxonomy_testing1"],
"terms": ["taxonomy_testing1.term_test1"],
"content_types": [
{
"uid": "$all",
"acl": {
"read": True,
"sub_acl": {
"read": True,
"create": True,
"update": True,
"delete": True,
"publish": True
}
}
}
],
"acl": {
"read": True,
"sub_acl": {
"read": True,
"create": True,
"update": True,
"delete": True,
"publish": True
}
}
}
]
}
Expand Down