From d6102c38fe13cd1c3fcda07be1ddbbd8dd14a556 Mon Sep 17 00:00:00 2001 From: Tom You <> Date: Sun, 20 Oct 2024 10:12:06 +0900 Subject: [PATCH] Add UT & update response package for python 3.9+ https://github.com/skorch-dev/skorch/issues/895 --- README.md | 13 +++++++++++++ nta/models/payload.py | 1 + requirements.txt | 2 +- tests/api/test_send_composite.py | 10 +++++++--- tests/api/test_send_image.py | 9 ++++++--- tests/api/test_send_text.py | 6 ++++-- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fdbb250..b1266a3 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ __Inspired By : [fbmq](https://github.com/conbus/fbmq) and [line-bot-sdk](https: ## Table of Contents * [Install](#install) +* [Run Unit Test](#Run-Unit-Test) * [Synopsis](#synopsis) * [API](#api) - [NaverTalkApi](#navertalkapi) @@ -80,9 +81,20 @@ __Inspired By : [fbmq](https://github.com/conbus/fbmq) and [line-bot-sdk](https: - [HandOverEvent](#handoverevent) ## Install +install as package to run ``` pip install nta ``` +To run dev environment +``` +pip install -r requirements.txt +``` + +## Run Unit Test +``` +python -m unittest +``` + ## Synopsis Usage (with flask) @@ -332,6 +344,7 @@ def hello_callback_handler(event): - message *Template* or *str*: 전송하고자 하는 메세지 - quick_reply *Template* or *list*: 빠른 답장 - notification *bool*: 푸쉬 메세지 설정 +- readBySend *bool*: 자동 읽음으로 표시 설정 - callback *func*: callback 함수. 메세지를 보내고 난 뒤에 실행된다. #### __Text__ diff --git a/nta/models/payload.py b/nta/models/payload.py index e5e882b..9f145c9 100644 --- a/nta/models/payload.py +++ b/nta/models/payload.py @@ -29,6 +29,7 @@ def __init__(self, message, quick_reply=None, notification=False, read_by_send=F - message: str or Template.TextContent - quick_reply: list of buttons or Template.QuickReply - notification: boolean + - readBySend: boolean """ super(GenericPayload, self).__init__(**kwargs) diff --git a/requirements.txt b/requirements.txt index b61b234..c3eb363 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,6 @@ idna==2.6 mock==2.0.0 pbr==3.1.1 requests>=2.20.0 -responses==0.8.1 +responses==0.12.0 six==1.11.0 urllib3>=1.23 diff --git a/tests/api/test_send_composite.py b/tests/api/test_send_composite.py index 245db82..83ecc67 100644 --- a/tests/api/test_send_composite.py +++ b/tests/api/test_send_composite.py @@ -75,7 +75,8 @@ def test_callback(res, payload): ] }, 'options': { - 'notification': False + 'notification': False, + 'readBySend': False } } ) @@ -152,7 +153,8 @@ def test_callback(res, payload): }, 'options': { - 'notification': False + 'notification': False, + 'readBySend': False } } ) @@ -239,7 +241,9 @@ def test_callback(res, payload): ] }, 'options': { - 'notification': False + 'notification': False, + 'readBySend': False + } } self.assertEqual(target, payload.as_json_dict()) diff --git a/tests/api/test_send_image.py b/tests/api/test_send_image.py index 37ab4ef..fde6bc4 100644 --- a/tests/api/test_send_image.py +++ b/tests/api/test_send_image.py @@ -46,7 +46,8 @@ def test_callback(res, payload): 'imageUrl': 'test.jpg', }, 'options': { - 'notification': False + 'notification': False, + 'readBySend': False } } ) @@ -72,7 +73,8 @@ def test_image_id_callback(res, payload): 'imageId': '1234test', }, 'options': { - 'notification': False + 'notification': False, + 'readBySend': False } } ) @@ -124,7 +126,8 @@ def test_callback(res, payload): 'type': 'LINK'}]} }, 'options': { - 'notification': False + 'notification': False, + 'readBySend': False } } ) diff --git a/tests/api/test_send_text.py b/tests/api/test_send_text.py index a7a6926..079794d 100644 --- a/tests/api/test_send_text.py +++ b/tests/api/test_send_text.py @@ -47,7 +47,8 @@ def test_callback(res, payload): 'inputType': None }, 'options': { - 'notification': False + 'notification': False, + 'readBySend': False } } ) @@ -92,7 +93,8 @@ def test_callback(res, payload): "event": "send", "user": "test_user_id", "options": { - "notification": False + "notification": False, + "readBySend": False }, "textContent": { "code": None,