Exemplo n.º 1
0
 def test_upload_file_error(self, mock_requests):
     json_to_text = json.dumps(stubs.bad_upload_file_response)
     mock_requests.post.return_value = Mock(
         status_code=404, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     error = sc.upload_file('README.rst', 'C0G9QF9GW').body['error']
     self.assertEqual('invalid_auth', error)
Exemplo n.º 2
0
 def test_upload_file(self, mock_requests):
     json_to_text = json.dumps(stubs.good_upload_file_response)
     mock_requests.post.return_value = Mock(
         status_code=200, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     upload = sc.upload_file('README.rst', 'C0G9QF9GW').body['file'].get('id')
     self.assertEqual('F0TD00400', upload)