Example #1
0
    def setUp(self):
        nico_comments = []
        datetime_format = '%Y-%m-%d %H:%M:%S'

        post_datetime = datetime.datetime.strptime('2013-01-05 00:00:00', datetime_format)
        self.nc1 = NicoComment('1', '1', post_datetime)
        nico_comments.append(self.nc1)

        post_datetime = datetime.datetime.strptime('2013-01-01 00:00:00', datetime_format)
        self.nc2 = NicoComment('2', '2', post_datetime)
        nico_comments.append(self.nc2)

        post_datetime = datetime.datetime.strptime('2013-01-06 00:00:00', datetime_format)
        self.nc3 = NicoComment('3', '3', post_datetime)
        nico_comments.append(self.nc3)

        post_datetime = datetime.datetime.strptime('2013-01-03 00:00:00', datetime_format)
        self.nc4 = NicoComment('4', '4', post_datetime)
        nico_comments.append(self.nc4)

        post_datetime = datetime.datetime.strptime('2012-01-03 00:00:00', datetime_format)
        self.nc5 = NicoComment('5', '5', post_datetime)
        nico_comments.append(self.nc5)

        self.nico_video = NicoVideo('titel', 'description_short', '00:00', '2012-01-03 00:00:00', 1, 2, {}, 3, 'id')
        self.nico_video.nico_comments = nico_comments
Example #2
0
class NicoVideoTest(unittest.TestCase):
    def setUp(self):
        nico_comments = []
        datetime_format = '%Y-%m-%d %H:%M:%S'

        post_datetime = datetime.datetime.strptime('2013-01-05 00:00:00', datetime_format)
        self.nc1 = NicoComment('1', '1', post_datetime)
        nico_comments.append(self.nc1)

        post_datetime = datetime.datetime.strptime('2013-01-01 00:00:00', datetime_format)
        self.nc2 = NicoComment('2', '2', post_datetime)
        nico_comments.append(self.nc2)

        post_datetime = datetime.datetime.strptime('2013-01-06 00:00:00', datetime_format)
        self.nc3 = NicoComment('3', '3', post_datetime)
        nico_comments.append(self.nc3)

        post_datetime = datetime.datetime.strptime('2013-01-03 00:00:00', datetime_format)
        self.nc4 = NicoComment('4', '4', post_datetime)
        nico_comments.append(self.nc4)

        post_datetime = datetime.datetime.strptime('2012-01-03 00:00:00', datetime_format)
        self.nc5 = NicoComment('5', '5', post_datetime)
        nico_comments.append(self.nc5)

        self.nico_video = NicoVideo('titel', 'description_short', '00:00', '2012-01-03 00:00:00', 1, 2, {}, 3, 'id')
        self.nico_video.nico_comments = nico_comments

    def test_tweet_msgs_for_latest_videos(self):
        latest_comments = self.nico_video.get_latest_comments(3)
        self.assertTrue(latest_comments[0] is self.nc4)
        self.assertTrue(latest_comments[1] is self.nc1)
        self.assertTrue(latest_comments[2] is self.nc3)