Exemplo n.º 1
0
    def test_pouet_group_id_must_be_numeric(self):
        gasman = Releaser.objects.get(name='Gasman')

        link = ReleaserExternalLink(releaser=gasman)
        link.url = 'https://www.pouet.net/groups.php?which=123'
        self.assertEqual(link.link_class, 'PouetGroup')
        self.assertEqual(link.parameter, 123)

        link = ReleaserExternalLink(releaser=gasman)
        link.url = 'https://www.pouet.net/groups.php?which=amigaaaa'
        self.assertEqual(link.link_class, 'BaseUrl')
        self.assertEqual(link.parameter,
                         'https://www.pouet.net/groups.php?which=amigaaaa')
Exemplo n.º 2
0
    def test_speccypl_author(self):
        gasman = Releaser.objects.get(name='Gasman')

        link = ReleaserExternalLink(releaser=gasman)
        link.url = 'http://speccy.pl/archive/author.php?id=24'
        self.assertEqual(link.link_class, 'SpeccyPlAuthor')
        self.assertEqual(link.parameter, 24)
Exemplo n.º 3
0
    def test_artcity_artist(self):
        gasman = Releaser.objects.get(name='Gasman')

        link = ReleaserExternalLink(releaser=gasman)
        link.url = 'http://artcity.bitfellas.org/index.php?a=artist&id=42'
        self.assertEqual(link.link_class, 'ArtcityArtist')
        self.assertEqual(link.parameter, 42)

        # 'a' query param must be present
        link = ReleaserExternalLink(releaser=gasman)
        link.url = 'http://artcity.bitfellas.org/index.php?x=artist&id=42'
        self.assertEqual(link.link_class, 'BaseUrl')
        self.assertEqual(
            link.parameter,
            'http://artcity.bitfellas.org/index.php?x=artist&id=42')

        # 'a' query param must be the expected value for the link type ('artist')
        link = ReleaserExternalLink(releaser=gasman)
        link.url = 'http://artcity.bitfellas.org/index.php?a=artichoke&id=42'
        self.assertEqual(link.link_class, 'BaseUrl')
        self.assertEqual(
            link.parameter,
            'http://artcity.bitfellas.org/index.php?a=artichoke&id=42')
Exemplo n.º 4
0
 def test_empty_link(self):
     rel = ReleaserExternalLink()
     rel.url = None
     self.assertEqual(rel.link_class, None)
     self.assertEqual(rel.parameter, None)