@@ -35,10 +35,10 @@ def test_handle_not_found(self):
3535 @mock .patch ('src.slack.Slack.post' )
3636 def test_install (self , mock_post ):
3737 res = {
38- 'incoming_webhook ' : { 'channel_id' : 'C0123456789' } ,
38+ 'app_id ' : 'A0123456789' ,
3939 'team' : {'id' : 'T0123456789' },
4040 }
41- loc = 'slack://channel ?team=T0123456789&id=C0123456789 '
41+ loc = 'slack://app ?team=T0123456789&id=A0123456789 '
4242 mock_post .return_value = res
4343 event = {
4444 'queryStringParameters' : {
@@ -72,15 +72,7 @@ def test_install_err(self, event, redir):
7272 if redir :
7373 self .subject .oauth_error_uri = redir
7474 ret = self .subject .install (HttpEvent (event ), '<oauth-method>' )
75- exp = {
76- 'statusCode' : 302 ,
77- 'body' : None ,
78- 'headers' : {
79- 'content-length' : '0' ,
80- 'content-type' : 'application/json; charset=utf-8' ,
81- 'location' : redir
82- }
83- }
75+ exp = (None , redir )
8476 assert ret == exp
8577 else :
8678 with pytest .raises (Exception ):
@@ -90,12 +82,12 @@ def test_install_err(self, event, redir):
9082 (
9183 'state-1' ,
9284 'https://example.com/install' ,
93- 'https://example.com/install?state=state-1' ,
85+ 'https://example.com/install?state=state-1&redirect_uri='
9486 ),
9587 (
9688 'state-2' ,
9789 'https://example.com/install?fizz=buzz' ,
98- 'https://example.com/install?fizz=buzz&state=state-2' ,
90+ 'https://example.com/install?fizz=buzz&state=state-2&redirect_uri='
9991 ),
10092 ])
10193 def test_install_url (self , state , oauth_install_uri , exp ):
@@ -117,7 +109,6 @@ def test_post(self):
117109 'url' : 'https://slack.com/api/chat.postMessage' ,
118110 'data' : b'{"test": "FIZZ"}' ,
119111 'headers' : {
120- 'authorization' : 'Bearer <token>' ,
121112 'content-type' : 'application/json; charset=utf-8' ,
122113 },
123114 },
@@ -130,7 +121,6 @@ def test_post(self):
130121 'url' : 'https://slack.com/api/files.upload' ,
131122 'data' : b'test=FIZZ' ,
132123 'headers' : {
133- 'authorization' : 'Bearer <token>' ,
134124 'content-type' : 'application/x-www-form-urlencoded' ,
135125 },
136126 },
0 commit comments