Beispiel #1
0
 def test_add_empty_msg(self):
     ChatLog.append("foo")
     ChatLog.append("")
     ChatLog.append("bar")
     self.assertEqual(ChatLog.read(), "foo\nbar")
Beispiel #2
0
 def test_add_newline(self):
     ChatLog.append("foo")
     ChatLog.append("\n")
     ChatLog.append("bar")
     self.assertEqual(ChatLog.read(), "foo\nbar")
Beispiel #3
0
 def test_read_empty_log(self):
     self.assertEqual(ChatLog.read(), "")
Beispiel #4
0
 def test_read_from_chat(self):
     ChatLog.log = collections.deque(["foo", "bar"])
     self.assertEqual(ChatLog.read(), "foo\nbar")
Beispiel #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")
Beispiel #6
0
def handle_event(json):
    ChatLog.append(json['msg'])
    emit("responce", json['msg'], broadcast=True)
Beispiel #7
0
def handle_new_connection(json):
    emit("connectResponce", ChatLog.read())