-
Notifications
You must be signed in to change notification settings - Fork 288
Expand file tree
/
Copy pathtest_complete.py
More file actions
41 lines (30 loc) · 1.39 KB
/
test_complete.py
File metadata and controls
41 lines (30 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import pytest
from slack_sdk import WebClient
from slack_bolt.context.complete import Complete
from tests.mock_web_api_server import (
setup_mock_web_api_server,
cleanup_mock_web_api_server,
)
class TestComplete:
def setup_method(self):
setup_mock_web_api_server(self)
valid_token = "xoxb-valid"
mock_api_server_base_url = "http://localhost:8888"
self.web_client = WebClient(token=valid_token, base_url=mock_api_server_base_url)
def teardown_method(self):
cleanup_mock_web_api_server(self)
def test_complete(self):
complete_success = Complete(client=self.web_client, function_execution_id="fn1111")
response = complete_success(outputs={"key": "value"})
assert response.status_code == 200
def test_complete_no_function_execution_id(self):
complete = Complete(client=self.web_client, function_execution_id=None)
with pytest.raises(ValueError):
complete(outputs={"key": "value"})
def test_has_been_called_false_initially(self):
complete = Complete(client=self.web_client, function_execution_id="fn1111")
assert complete.has_been_called() is False
def test_has_been_called_true_after_complete(self):
complete = Complete(client=self.web_client, function_execution_id="fn1111")
complete(outputs={"key": "value"})
assert complete.has_been_called() is True