Пример #1
0
    def testUpdateArtist(self):
        """Test updating artist."""
        artist = tunes_db.Artist()
        artist.artist_id = str(self.wendy_carlos.key())
        artist.name = u'Walter Carlos'
        request = tunes_db.UpdateArtistRequest()
        request.artist = artist

        response = self.service.update_artist(request)
        response.check_initialized()

        self.assertTrue(response.artist_updated)
        walter_carlos = model.ArtistInfo.get(self.wendy_carlos.key())
        self.assertEquals(u'Walter Carlos', walter_carlos.name)
Пример #2
0
    def post(self):
        """Update new artist."""
        artist_id = self.request.params['artist_id']
        artist = tunes_db.Artist(artist_id=artist_id,
                                 name=self.request.params['artist_name'])
        response = music_service.update_artist(artist=artist)

        logging.info('Update artist %s success: %s', artist_id,
                     response.artist_updated)

        if response.artist_updated:
            error_message = None
        else:
            error_message = 'Update artist failed.'

        self.go('/artist', artist_id=artist_id, error_message=error_message)
Пример #3
0
    def testUpdateArtist_NotFound(self):
        """Test updating artist when artist no longer exists."""
        wendy_carlos_key = self.wendy_carlos.key()
        self.wendy_carlos.delete()

        artist = tunes_db.Artist()
        artist.artist_id = str(wendy_carlos_key)
        artist.name = u'Walter Carlos'
        request = tunes_db.UpdateArtistRequest()
        request.artist = artist

        response = self.service.update_artist(request)
        response.check_initialized()

        self.assertFalse(response.artist_updated)
        self.assertEquals(None, model.ArtistInfo.get(wendy_carlos_key))