コード例 #1
0
 def test_add_empty_msg(self):
     ChatLog.append("foo")
     ChatLog.append("")
     ChatLog.append("bar")
     self.assertEqual(ChatLog.read(), "foo\nbar")
コード例 #2
0
 def test_add_newline(self):
     ChatLog.append("foo")
     ChatLog.append("\n")
     ChatLog.append("bar")
     self.assertEqual(ChatLog.read(), "foo\nbar")
コード例 #3
0
 def test_read_empty_log(self):
     self.assertEqual(ChatLog.read(), "")
コード例 #4
0
 def test_read_from_chat(self):
     ChatLog.log = collections.deque(["foo", "bar"])
     self.assertEqual(ChatLog.read(), "foo\nbar")
コード例 #5
0
 def test_append_to_chat(self):
     for i in range(10):
         ChatLog.append(self.testString + str(i))
     self.assertEqual(ChatLog.read(), "test5\ntest6\ntest7\ntest8\ntest9")
コード例 #6
0
ファイル: app.py プロジェクト: EliasRosendahl/flaskChat
def handle_event(json):
    ChatLog.append(json['msg'])
    emit("responce", json['msg'], broadcast=True)
コード例 #7
0
ファイル: app.py プロジェクト: EliasRosendahl/flaskChat
def handle_new_connection(json):
    emit("connectResponce", ChatLog.read())