Esempio n. 1
0
 def test_set_topic_error(self, mock_requests):
     json_to_text = json.dumps(stubs.bad_set_topic_response)
     mock_requests.post.return_value = Mock(
         status_code=500, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     error = sc.set_topic('C0G9QF9GW', 'My topic').body['error']
     self.assertEqual('user_is_restricted', error)
Esempio n. 2
0
 def test_set_topic(self, mock_requests):
     json_to_text = json.dumps(stubs.good_set_topic_response)
     mock_requests.post.return_value = Mock(
         status_code=200, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     topic = sc.set_topic('C0G9QF9GW', 'My topic').body['topic']
     self.assertEqual('My topic', topic)