Пример #1
0
    def test_get_how_many_days_ago_was_creation_7_days_ago(self):
        """should return 7 when the current date and the creation date are 
        7 days apart"""
        test_channel = Channel("My Ballad", "John Henry")
        test_channel.creation_time = datetime.today() - timedelta(7)

        self.assertEqual(test_channel._get_how_many_days_ago_was_creation(), 7)
Пример #2
0
    def test_get_how_many_days_ago_was_creation_yesterday(self):
        """should return 1 if the creation day is the day before the current 
        day"""
        test_channel = Channel("Kérsz Taslit?", "Zuboly")
        test_channel.creation_time = datetime.today() - timedelta(1) 

        self.assertEqual(test_channel._get_how_many_days_ago_was_creation(), 1)
Пример #3
0
    def test_get_how_many_days_ago_was_creation_6_days_ago(self):
        """should return 6 when the current date and the creation date are 
        6 days apart"""
        test_channel = Channel("Black Rock", "Joe Bonamassa")
        test_channel.creation_time = datetime.today() - timedelta(6)

        self.assertEqual(test_channel._get_how_many_days_ago_was_creation(), 6)
Пример #4
0
    def test_get_how_many_days_ago_was_creation_366_days_ago(self):
        """should return 366 when the current date and the creation date are 
        366 days apart. 
        NOTE: using days instead of years is intentional (leap years!)
        """
        test_channel = Channel("My Ballad", "John Henry")
        test_channel.creation_time = datetime.today() - timedelta(366)

        self.assertEqual(test_channel._get_how_many_days_ago_was_creation(),
                        366)
Пример #5
0
    def test_get_how_many_days_ago_was_creation_today(self):
        """should return 0 if the creation day is the current day"""
        test_channel = Channel("Kerekes", "Tanyasi Jóska")

        self.assertEqual(test_channel._get_how_many_days_ago_was_creation(), 0)