Skip to content

Commit 4c334b5

Browse files
author
Tasuku OKUDA
committed
Modify tests using resource file to close it.
1 parent 52fc4f2 commit 4c334b5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_webhook.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def test_validate(self):
4040
class TestWebhookParser(unittest.TestCase):
4141
def test_parse(self):
4242
file_dir = os.path.dirname(__file__)
43-
body = open(
44-
os.path.join(file_dir, 'text', 'webhook.json')
45-
).read()
43+
webhook_sample_json_path = os.path.join(file_dir, 'text', 'webhook.json')
44+
with open(webhook_sample_json_path) as fp:
45+
body = fp.read()
4646

4747
parser = WebhookParser('channel_secret')
4848
# mock
@@ -315,9 +315,9 @@ def default(event):
315315

316316
def test_hoge(self):
317317
file_dir = os.path.dirname(__file__)
318-
body = open(
319-
os.path.join(file_dir, 'text', 'webhook.json')
320-
).read()
318+
webhook_sample_json_path = os.path.join(file_dir, 'text', 'webhook.json')
319+
with open(webhook_sample_json_path) as fp:
320+
body = fp.read()
321321

322322
# mock
323323
self.handler.parser.signature_validator.validate = lambda a, b: True

0 commit comments

Comments
 (0)