test topic_setter and topic_time in TOPIC test too

This commit is contained in:
jesopo 2021-09-06 02:51:34 +00:00
parent 806c6e4bf3
commit 8c16b73414
2 changed files with 10 additions and 2 deletions

View File

@ -1,2 +1,3 @@
freezegun ~=1.1.0
irctokens ~=2.0.0
pendulum ~=2.1.0

View File

@ -1,6 +1,7 @@
import unittest
import pendulum
import ircstates, irctokens
from freezegun import freeze_time
class ChannelTestJoin(unittest.TestCase):
def test_self_join(self):
@ -101,8 +102,14 @@ class ChannelTestTopic(unittest.TestCase):
server = ircstates.Server("test")
server.parse_tokens(irctokens.tokenise("001 nickname *"))
server.parse_tokens(irctokens.tokenise(":nickname JOIN #chan"))
server.parse_tokens(irctokens.tokenise("TOPIC #chan :hello there"))
self.assertEqual(server.channels["#chan"].topic, "hello there")
dt = pendulum.datetime(2021, 9, 6, 2, 43, 22)
with freeze_time("2021-09-06 02:43:22"):
server.parse_tokens(irctokens.tokenise(":other TOPIC #chan :hello there"))
channel = server.channels["#chan"]
self.assertEqual(channel.topic, "hello there")
self.assertEqual(channel.topic_setter, "other")
self.assertEqual(channel.topic_time, dt)
class ChannelTestCreation(unittest.TestCase):
def test(self):