Beispiel #1
0
    def test_init_timestamp(self):
        g = episode.Game('Testgame3', timestamp_string=None,
                         timestamp=1191)  #19m, 51s
        self.assertEqual(g.name, 'Testgame3')
        self.assertEqual(g.timestamp_string, '19:51')
        self.assertEqual(g.timestamp, 1191)

        g = episode.Game('Testgame4', timestamp_string=None, timestamp=303)
        self.assertEqual(g.name, 'Testgame4')
        self.assertEqual(g.timestamp_string, '05:03')
        self.assertEqual(g.timestamp, 303)
Beispiel #2
0
    def test_init_timestamp_string(self):
        g = episode.Game('Testgame', '06:12')
        self.assertEqual(g.name, 'Testgame')
        self.assertEqual(g.timestamp_string, '06:12')
        self.assertEqual(g.timestamp, 372)
        self.assertEqual(f'{g}', 'Testgame @06:12 (372s)')
        self.assertEqual(g.__repr__(), 'Testgame @06:12 (372s)')

        g = episode.Game('Testgame2', '1:35:00')
        self.assertEqual(g.name, 'Testgame2')
        self.assertEqual(g.timestamp_string, '1:35:00')
        self.assertEqual(g.timestamp, 5700)
Beispiel #3
0
    def test_html_for_episode(self):
        url = 'https://example.com'
        audio_url = 'https://example.com/mp3.mp3'
        cover_url = 'https://example.com/img.jpg'
        title = 'Testtitle'
        description = 'Testdescription'
        duration_string = '01:06:32'
        pubdate_string = 'Thu, 26 Nov 2020 14:17:00 +0000'
        e = episode.Episode(url=url,
                            audio_url=audio_url,
                            cover_url=cover_url,
                            title=title,
                            description=description,
                            pubdate_string=pubdate_string,
                            duration_string=duration_string)
        e.games = [
            episode.Game('Testgame', '06:12'),
            episode.Game('Testgame2', '1:35:00')
        ]

        html = sitebuilder.html_for_episode(e)
        self.assertIsNotNone(html)
        root = ET.fromstring(html)
        self.assertEqual(root.tag, 'section')
        self.assertEqual(len(root.findall('./*[@class="title"]')),
                         1)  #exactly one title
        images = root.findall('img')
        self.assertEqual(len(images), 1)  #exactly one image, should be cover
        self.assertEqual(images[0].attrib['src'], cover_url)
        gameslist = root.findall('./*[@class="gameslist"]')[0].find(
            'ul').findall('li')
        self.assertEqual(len(gameslist), 2)
        game1 = gameslist[0].find('a')
        self.assertEqual(game1.attrib['href'], 'https://example.com#t=6:12')
        self.assertEqual(game1.text, '06:12 - Testgame')
        game2 = gameslist[1].find('a')
        self.assertEqual(game2.attrib['href'], 'https://example.com#t=95:00')
        self.assertEqual(game2.text, '1:35:00 - Testgame2')
Beispiel #4
0
 def test_games_from_manual_fixes(self):
     manual_fixes = [
         {
             "name": "Marvel's Avengers",
             "timestamp_string": "6:41"
         },
         {
             "name": "Fall Guys",
             "timestamp": 1150
         },
         {
             "name": "This is only a test",
             "timestamp_string": "10:51",
             "timestamp": 4242  #1h, 10m, 42s
         }
     ]
     found_games = episode.Game.from_manual_fixes(manual_fixes)
     #Prefer the string from manual fixes
     expected_games = [
         episode.Game("Marvel's Avengers", '6:41'),
         episode.Game('Fall Guys', '19:10'),
         episode.Game('This is only a test', '10:51')
     ]
     self.assertEqual(found_games, expected_games)
Beispiel #5
0
    def test_games_from_episode_description(self):
        #Taken form Ep. 309
        desc = '''
    The conspiracy is finally unmasked.

    Games we played this week include:
    Hades (12:20)
    Call of Duty: Cold War (15:50)
    Spider-Man: Miles Morales (17:00)
    Hyrule Warriors: Age of Calamity (26:30)
    River City Girls (37:30)
    Super Mutant Alien Assault (38:40)
    Yakuza: Like a Dragon (40:35)
    Sackboy: A Big Adventure (45:00)

    News things talked about in this episode:
    Capcom ransomware attack (50:20)
    Square Enix commits to permanent work-from-home option (55:00)
    Amazon PS5 shipping issues (1:06:30)

    Find Laura at LauraKBuzz on Twitter, Twitch, YouTube, and Patreon. All her content goes on LauraKBuzz.com, and you can catch Access-Ability on YouTube every Friday.

    Follow Conrad at ConradZimmerman on Twitter and check out his Patreon (patreon.com/fistshark). You can also peruse his anti-capitalist propaganda at pinfultruth.com.
    '''
        found_games = episode.Game.from_episode_description(desc)

        expected_games = [
            episode.Game('Hades', '12:20'),
            episode.Game('Call of Duty: Cold War', '15:50'),
            episode.Game('Spider-Man: Miles Morales', '17:00'),
            episode.Game('Hyrule Warriors: Age of Calamity', '26:30'),
            episode.Game('River City Girls', '37:30'),
            episode.Game('Super Mutant Alien Assault', '38:40'),
            episode.Game('Yakuza: Like a Dragon', '40:35'),
            episode.Game('Sackboy: A Big Adventure', '45:00'),
            episode.Game('Capcom ransomware attack', '50:20'),
            episode.Game(
                'Square Enix commits to permanent work-from-home option',
                '55:00'),
            episode.Game('Amazon PS5 shipping issues', '1:06:30')
        ]
        self.assertEqual(found_games, expected_games)
Beispiel #6
0
 def test_init_timestamp_string_and_timestamp(self):
     #Always prioritize seconds directly
     g = episode.Game('Testgame5', timestamp_string='07:59', timestamp=1191)
     self.assertEqual(g.name, 'Testgame5')
     self.assertEqual(g.timestamp_string, '19:51')
     self.assertEqual(g.timestamp, 1191)