def send_warnings(team: str): logging.info("Sending warning! Results: \n{}".format( client.get_answer(team, show_all=True))) user_list = slack_client.api_call("users.list")[ "members"] # use this to get users. for email in cfg["teams"][team]["users_to_notify"]: user = [ user for user in user_list if user["profile"].get("email", "") == email ][0] # use this to get id user_channel = slack_client.api_call( "im.open", user=user["id"])["channel"]["id"] # use this to get dm channel send_reminder(user_channel, team)
def stop_estimations(team: str): logging.info("Estimation finished! Results: \n{}".format( client.get_answer(team, show_all=True))) user_list = slack_client.api_call("users.list")[ "members"] # use this to get users. for email in cfg["teams"][team]["users_to_notify"]: user = [ user for user in user_list if user["profile"].get("email", "") == email ][0] # use this to get id user_channel = slack_client.api_call( "im.open", user=user["id"])["channel"]["id"] # use this to get dm channel end_conversation(user_channel, team) start_meeting(team)
def test_400_ans(self): """Тест создания корректного ответа 400""" self.assertEqual(get_answer({RESPONSE: 400, ERROR: 'Bad Request'}), '400 : Bad Request')
def test_200_ans(self): """Тест создания корректного ответа 200""" self.assertEqual(get_answer({RESPONSE: 200}), '200 : OK')
def test_without_response(self): with self.assertRaises(ValueError): get_answer({})
def test_answer_400(self): self.assertEqual(get_answer({ RESPONSE: 400, ERROR: 'Bad Request' }), '400 : Bad Request')
def test_answer_200(self): self.assertEqual(get_answer({RESPONSE: 200}), '200 : OK')