def test_follow_channel_without_collision(self): c1 = Channel("c1") c2 = Channel("c2") u2 = User("u2") phone_numbers = list() channels = [c1, c2] followings = [Following("u1", "c1")] phone_numbers = c1.broadcast(phone_numbers, channels, followings) phone_numbers = c2.broadcast(phone_numbers, channels, followings) u2.follow_channel("c2", channels, phone_numbers, followings) self.assertEqual(c1.phone_number, c2.phone_number)
followings, phone_numbers = u2.follow_channel(c1.channel_uid, channels, phone_numbers, followings) # followings, phone_numbers = u2.follow_channel(c3.channel_uid, channels, phone_numbers, followings) c4 = Channel("c4") channels.append(c4) phone_numbers = c4.broadcast(phone_numbers, channels, followings) phone_numbers = c4.broadcast(phone_numbers, channels, followings) followings, phone_numbers = u1.follow_channel(c4.channel_uid, channels, phone_numbers, followings) followings, phone_numbers = u3.follow_channel(c4.channel_uid, channels, phone_numbers, followings) c5 = Channel("c5") channels.append(c5) u5 = User("u5") users.append(u5) followings, phone_numbers = u5.follow_channel(c5.channel_uid, channels, phone_numbers, followings) phone_numbers = c5.broadcast(phone_numbers, channels, followings) print(followings) print(c1) print(c2) print(c3) print(c4) print(c5) print(phone_numbers)