Skip to content

Commit

Permalink
Edinting the default documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
darcivieira committed Nov 6, 2023
1 parent dcdb971 commit 2cb0a91
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/api/columns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
::: endpoints.columns
3 changes: 3 additions & 0 deletions kanbanize_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
LanesInsertBody,
LanesUpdateBody,
LanesListParams,
ColumnsListParams,
ColumnsInsertBody,
ColumnsUpdateBody,
)
6 changes: 5 additions & 1 deletion kanbanize_sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
BoardStructureRevisions,
BoardHistory,
Workflows,
Lanes
Lanes,
Columns,
)


Expand Down Expand Up @@ -58,3 +59,6 @@ def workflows(self):

def lanes(self):
return Lanes(self.service)

def columns(self):
return Columns(self.service)
1 change: 1 addition & 0 deletions kanbanize_sdk/endpoints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
from .board_history import BoardHistory
from .workflows import Workflows
from .lanes import Lanes
from .columns import Columns
3 changes: 1 addition & 2 deletions kanbanize_sdk/endpoints/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def list(self, board_id: int, params: ColumnsListParams | None = None, *args, **
Returns:
An array of objects that represents the columns
"""
return self.service.get(
self.endpoint + f'/{board_id}/columns',
Expand All @@ -38,7 +37,7 @@ def insert(self, board_id: int, body: ColumnsInsertBody, *args, **kwargs):
Returns:
A column object with the basic information data.
"""
return self.service.get(self.endpoint + f'/{board_id}/columns', data=body.to_dict())
return self.service.post(self.endpoint + f'/{board_id}/columns', data=body.to_dict())

def get(self, board_id: int, column_id: int, *args, **kwargs):
"""
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ markers = [
"workspaces_history",
"workflows",
"lanes",
"columns",
]

[build-system]
Expand Down
51 changes: 51 additions & 0 deletions tests/test_columns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from pytest import mark
from kanbanize_sdk import Kanbanize, ColumnsInsertBody


@mark.columns
def test_list_columns(requests_mock):
test_json = {
'data': [
{
'column_id': 1,
'workflow': 0,
'section': 0,
'parent_column_id': 0,
'position': 0,
'name': 'Teste',
'description': 'Description teste',
'color': 'ffffff',
'limit': 0,
'cards_per_row': 0,
'flow_type': 1
}
]
}
requests_mock.get('https://teste.kanbanize.com/api/v2/boards/1/columns', json=test_json)
service = Kanbanize({'subdomain': 'teste', 'api_key': 'teste_key'})
assert service.columns().list(board_id=1) == test_json.get('data')


@mark.columns
def test_inset_columns(requests_mock):
test_json = {
'data': {
'column_id': 0,
'workflow': 0,
'section': 0,
'parent_column_id': 0,
'position': 0,
'name': 'Teste',
'description': 'Description teste',
'color': 'ffffff',
'limit': 0,
'cards_per_row': 0,
'flow_type': 1
}
}
requests_mock.post('https://teste.kanbanize.com/api/v2/boards/1/columns', json=test_json)
service = Kanbanize({'subdomain': 'teste', 'api_key': 'teste_key'})
body = ColumnsInsertBody(
workflow_id=1, section=1, parent_column_id=1, position=1, name='Test', limit=0, cards_per_row=0, flow_type=0
)
assert service.columns().insert(board_id=1, body=body) == test_json.get('data')

0 comments on commit 2cb0a91

Please sign in to comment.