Exemple #1
0
 def test_succeed_link(self):
     local_artist = Artist.objects.create(name='artist_name')
     artist_form = ArtistForm(data={'pk': self.pk, 'create': 0, 'name_hidden': self.artist_name, 
                                    'release_title_hidden': 'release_title','mdx_artist_id': local_artist.pk})
     artist_form.is_valid()
     artist_processor = ArtistProcessor(delivery=self.delivery, artist_form=artist_form, vendor=self.vendor)
     artist  = artist_processor.build()
     self.assertEquals(local_artist, artist)
     self. _report_check(local_artist, artist_form.report)
Exemple #2
0
 def test_succeed_create(self):
     artist_form = ArtistForm(data={'pk': self.pk, 'create': 1, 'name_hidden': self.artist_name, 
                               'release_title_hidden': 'release_title', 'url': self.url})
     artist_form.is_valid()
     artist_processor = ArtistProcessor(delivery=self.delivery, artist_form=artist_form, vendor=self.vendor)
     produced_artist = artist_processor.build()
     expected_artist = Artist.objects.get(artistvendor__external_artist_id=self.pk)
     self.assertEquals(expected_artist, produced_artist)
     self. _report_check(expected_artist, artist_form.report)       
Exemple #3
0
 def test_fail_incorrect_pk_type(self):
     delivery_artist = self.delivery.artist
     delivery_artist.pk = 'pk'
     artist_form = ArtistForm(data={'pk': self.pk, 'create': 1, 'name_hidden': self.artist_name, 
                                    'url': self.url, 'release_title_hidden': self.delivery.release.title,})
     artist_form.is_valid()
     artist_processor = ArtistProcessor(delivery=self.delivery, artist_form=artist_form, vendor=self.vendor)
     artist  = artist_processor.build()
     self.assertEquals(None, artist)
     self.assertFalse(artist_form.report.success)
     self.assertTrue(artist_form.report.error)
Exemple #4
0
 def test_link_with_wrong_artist_id(self):
     artist_form = ArtistForm(data={'pk': 1, 'name': 'jojo', 'create': 0, 'mdx_artist_id': 3})
     self.assertFalse(artist_form.is_valid())
     self.assertEqual(["L'artiste n'existe pas"], artist_form._errors['mdx_artist_id'])       
Exemple #5
0
 def test_not_create_with_no_artist_id(self):
     artist_form = ArtistForm(data={'pk': 1, 'name': 'jojo', 'create': 0})
     self.assertFalse(artist_form.is_valid())
     self.assertEqual(["Vous devez sélectionner un artiste"], artist_form._errors['mdx_artist_id'])
Exemple #6
0
 def test_create_with_no_url(self):
     artist_form = ArtistForm(data={'pk': 1, 'mdx_artist_id': 72, 'create': 1, 'name_hidden': 'tutu'})
     self.assertFalse(artist_form.is_valid())
     self.assertEqual(["Entrez un URL"], artist_form._errors['url'])