コード例 #1
0
 def test__get_stream_class(self, mock_consumer):
     consumer = StreamConsumer()
     consumer.stream_name = "public"
     self.assertEqual(consumer._get_stream_class(), PublicStream)
     consumer.stream_name = "followed"
     self.assertEqual(consumer._get_stream_class(), FollowedStream)
     consumer.stream_name = "tag"
     self.assertEqual(consumer._get_stream_class(), TagStream)
     consumer.stream_name = "profile_all"
     self.assertEqual(consumer._get_stream_class(), ProfileAllStream)
     consumer.stream_name = "profile_pinned"
     self.assertEqual(consumer._get_stream_class(), ProfilePinnedStream)
コード例 #2
0
 def test__get_stream_class(self, mock_consumer):
     consumer = StreamConsumer()
     with patch.object(consumer,
                       "_get_stream_info",
                       return_value=("public", None)):
         self.assertEqual(consumer._get_stream_class(), PublicStream)
     with patch.object(consumer,
                       "_get_stream_info",
                       return_value=("followed", None)):
         self.assertEqual(consumer._get_stream_class(), FollowedStream)
     with patch.object(consumer,
                       "_get_stream_info",
                       return_value=("tag", None)):
         self.assertEqual(consumer._get_stream_class(), TagStream)