Skip to content

Commit

Permalink
Add UT & update response package for python 3.9+
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom You committed Oct 20, 2024
1 parent fdf16db commit d6102c3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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__
Expand Down
1 change: 1 addition & 0 deletions nta/models/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 7 additions & 3 deletions tests/api/test_send_composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def test_callback(res, payload):
]
},
'options': {
'notification': False
'notification': False,
'readBySend': False
}
}
)
Expand Down Expand Up @@ -152,7 +153,8 @@ def test_callback(res, payload):

},
'options': {
'notification': False
'notification': False,
'readBySend': False
}
}
)
Expand Down Expand Up @@ -239,7 +241,9 @@ def test_callback(res, payload):
]
},
'options': {
'notification': False
'notification': False,
'readBySend': False

}
}
self.assertEqual(target, payload.as_json_dict())
Expand Down
9 changes: 6 additions & 3 deletions tests/api/test_send_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def test_callback(res, payload):
'imageUrl': 'test.jpg',
},
'options': {
'notification': False
'notification': False,
'readBySend': False
}
}
)
Expand All @@ -72,7 +73,8 @@ def test_image_id_callback(res, payload):
'imageId': '1234test',
},
'options': {
'notification': False
'notification': False,
'readBySend': False
}
}
)
Expand Down Expand Up @@ -124,7 +126,8 @@ def test_callback(res, payload):
'type': 'LINK'}]}
},
'options': {
'notification': False
'notification': False,
'readBySend': False
}
}
)
Expand Down
6 changes: 4 additions & 2 deletions tests/api/test_send_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def test_callback(res, payload):
'inputType': None
},
'options': {
'notification': False
'notification': False,
'readBySend': False
}
}
)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d6102c3

Please sign in to comment.