Exemple #1
0
 def test_get_info(self):
     self.create_users()
     self.create_dialog(self.u1, self.u2, dialog_name='First_dialog')
     self.assertEqual(Dialog.get_dialog_info(self.u1, self.u2, info='id'),
                      1)
     self.assertEqual(
         Dialog.get_dialog_info(self.u1, self.u2, info='dialog_name'),
         'First_dialog')
Exemple #2
0
def send_message(username):
    user = User.query.filter_by(username=username).first_or_404()
    if not user:
        return redirect(url_for('index'))
    dialog_id = Dialog.get_dialog_info(current_user, user, info='id')
    return redirect(url_for('dialogs.dialog', id=dialog_id))