def delete_user(musicbrainz_id): """ Delete a user from ListenBrainz completely. First, drops the user's influx measurement and then deletes her from the database. Args: musicbrainz_id (str): the MusicBrainz ID of the user Raises: NotFound if user isn't present in the database """ user = _get_user(musicbrainz_id) _influx.delete(user.musicbrainz_id) publish_data_to_queue( data={ 'type': 'delete.user', 'musicbrainz_id': musicbrainz_id, }, exchange=current_app.config['BIGQUERY_EXCHANGE'], queue=current_app.config['BIGQUERY_QUEUE'], error_msg= 'Could not put user %s into queue for deletion, please try again later' % musicbrainz_id, ) db_user.delete(user.id)
def delete_user(user_id: int): """ Delete a user from ListenBrainz completely. First, drops the user's listens and then deletes the user from the database. Args: user_id: the LB row ID of the user """ timescale_connection._ts.delete(user_id) db_user.delete(user_id)
def test_delete_when_spotify_import_activated(self): user_id = db_user.create(11, 'kishore') user = db_user.get(user_id) self.assertIsNotNone(user) db_spotify.create_spotify(user_id, 'user token', 'refresh token', 0) db_user.delete(user_id) user = db_user.get(user_id) self.assertIsNone(user) token = db_spotify.get_token_for_user(user_id) self.assertIsNone(token)
def delete_user(user): influx.delete(user['musicbrainz_id']) publish_data_to_queue( data={ 'type': 'delete.user', 'musicbrainz_id': user['musicbrainz_id'], }, exchange=app.config['BIGQUERY_EXCHANGE'], queue=app.config['BIGQUERY_QUEUE'], error_msg='Could not upt user %s into queue for bq deletion.' % user['musicbrainz_id'], ) db_user.delete(user['id'])
def delete_user(musicbrainz_id): """ Delete a user from ListenBrainz completely. First, drops the user's listens and then deletes the user from the database. Args: musicbrainz_id (str): the MusicBrainz ID of the user Raises: NotFound if user isn't present in the database """ user = _get_user(musicbrainz_id) timescale_connection._ts.delete(user.musicbrainz_id) db_user.delete(user.id)
def delete_user(user): influx.delete(user['musicbrainz_id']) publish_data_to_queue( data={ 'type': 'delete.user', 'musicbrainz_id': user['musicbrainz_id'], }, exchange=app.config['BIGQUERY_EXCHANGE'], queue=app.config['BIGQUERY_QUEUE'], error_msg='Could not upt user %s into queue for bq deletion.' % user['musicbrainz_id'], ) db_user.delete(user['id'])
def test_delete_when_spotify_import_activated(self): user_id = db_user.create(11, 'kishore') user = db_user.get(user_id) self.assertIsNotNone(user) db_oauth.save_token(user_id, ExternalServiceType.SPOTIFY, 'user token', 'refresh token', 0, True, ['user-read-recently-played']) db_user.delete(user_id) user = db_user.get(user_id) self.assertIsNone(user) token = db_oauth.get_token(user_id, ExternalServiceType.SPOTIFY) self.assertIsNone(token)
def test_delete(self): user_id = db_user.create(10, 'frank') user = db_user.get(user_id) self.assertIsNotNone(user) with open(self.path_to_data_file('user_top_artists_db.json')) as f: artists_data = ujson.load(f) db_stats.insert_user_artists( user_id=user_id, artists=UserArtistStatJson(**{'all_time': artists_data}), ) user_stats = db_stats.get_user_artists(user_id, 'all_time') self.assertIsNotNone(user_stats) db_user.delete(user_id) user = db_user.get(user_id) self.assertIsNone(user) user_stats = db_stats.get_user_artists(user_id, 'all_time') self.assertIsNone(user_stats)
def test_delete(self): user_id = db_user.create(10, 'frank') user = db_user.get(user_id) self.assertIsNotNone(user) db_stats.insert_user_stats( user_id=user_id, artists={}, recordings={}, releases={}, artist_count=2, ) user_stats = db_stats.get_all_user_stats(user_id) self.assertIsNotNone(user_stats) db_user.delete(user_id) user = db_user.get(user_id) self.assertIsNone(user) user_stats = db_stats.get_all_user_stats(user_id) self.assertIsNone(user_stats)
def test_delete(self): user_id = db_user.create(10, 'frank') user = db_user.get(user_id) self.assertIsNotNone(user) with open(self.path_to_data_file('user_top_artists_db.json')) as f: artists_data = ujson.load(f) db_stats.insert_user_jsonb_data( user_id=user_id, stats_type='artists', stats=StatRange[EntityRecord](**artists_data), ) user_stats = db_stats.get_user_stats(user_id, 'all_time', 'artists') self.assertIsNotNone(user_stats) db_user.delete(user_id) user = db_user.get(user_id) self.assertIsNone(user) user_stats = db_stats.get_user_stats(user_id, 'all_time', 'artists') self.assertIsNone(user_stats)
def delete_user(musicbrainz_id): """ Delete a user from ListenBrainz completely. First, drops the user's influx measurement and then deletes her from the database. Args: musicbrainz_id (str): the MusicBrainz ID of the user Raises: NotFound if user isn't present in the database """ user = _get_user(musicbrainz_id) _influx.delete(user.musicbrainz_id) publish_data_to_queue( data={ 'type': 'delete.user', 'musicbrainz_id': musicbrainz_id, }, exchange=current_app.config['BIGQUERY_EXCHANGE'], queue=current_app.config['BIGQUERY_QUEUE'], error_msg='Could not put user %s into queue for deletion, please try again later' % musicbrainz_id, ) db_user.delete(user.id)