Example #1
0
 def test_list_all_users_error(self, mock_requests):
     json_to_text = json.dumps(stubs.bad_user_list_response)
     mock_requests.get.return_value = Mock(
         status_code=500, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     sc_gen = next(sc.list_all_users())
     error = sc_gen.body['error']
     self.assertEqual('fatal_error', error)
Example #2
0
 def test_list_all_users(self, mock_requests):
     json_to_text = json.dumps(stubs.good_user_list_response)
     mock_requests.get.return_value = Mock(
         status_code=200, text=json_to_text,
     )
     sc = Slackest(token='aaa')
     sc_gen = next(sc.list_all_users())
     all_users = sc_gen.body['members']
     first_user_id = all_users[0].get('id')
     self.assertEqual('W012A3CDE', first_user_id)