Esempio n. 1
0
 def test_cards(self):
     channel = InMemoryChannel("radio_ga_ga")
     card1, card2 = object(), object()
     self.assert_cards(channel, [])
     channel.publish(card1)
     self.assert_cards(channel, [card1])
     channel.publish(card2)
     self.assert_cards(channel, [card1, card2])
Esempio n. 2
0
 def test_cards(self):
     channel = InMemoryChannel("radio_ga_ga")
     card1, card2 = object(), object()
     self.assert_cards(channel, [])
     channel.publish(card1)
     self.assert_cards(channel, [card1])
     channel.publish(card2)
     self.assert_cards(channel, [card1, card2])
Esempio n. 3
0
    def test_publish(self):
        channel = InMemoryChannel("radio_ga_ga")
        card1, card2 = object(), object()
        recorder = Recorder()
        client = mk_client(recorder)
        channel.subscribe(client)

        self.assertEqual(recorder.calls, [])
        channel.publish(card1)
        self.assertEqual(recorder.calls, [
            ("radio_ga_ga", card1),
        ])
        channel.publish(card2)
        self.assertEqual(recorder.calls, [
            ("radio_ga_ga", card1),
            ("radio_ga_ga", card2),
        ])
Esempio n. 4
0
    def test_publish(self):
        channel = InMemoryChannel("radio_ga_ga")
        card1, card2 = object(), object()
        recorder = Recorder()
        client = mk_client(recorder)
        channel.subscribe(client)

        self.assertEqual(recorder.calls, [])
        channel.publish(card1)
        self.assertEqual(recorder.calls, [
            ("radio_ga_ga", card1),
        ])
        channel.publish(card2)
        self.assertEqual(recorder.calls, [
            ("radio_ga_ga", card1),
            ("radio_ga_ga", card2),
        ])