def test_import(self): """ Import a sample voting history from Filmweb """ path = os.path.dirname('') votes_url = os.path.abspath('import_ratings/tests/test_data/filmweb_rankings.txt') votes_file = open(votes_url, 'rb') frf = FilmwebRatingsFetcher(self.u1, "dasm", "filmweb", kind=ImportRatings.FILMWEB, overwrite=True, votes_url=votes_file.read()) all_ratings = ImportRatings.objects.all() self.assertEquals(len(all_ratings), 1) import_ratings() ratingsLogs = ImportRatingsLog.objects.all() self.assertEquals(len(ratingsLogs), 1) ratings = Rating.objects.all() self.assertEquals(len(ratings), 4)
import os, sys PROJECT_ROOT = os.curdir #sys.path.insert(0, os.path.join(PROJECT_ROOT+"/", "fetcher")) os.environ['DJANGO_SETTINGS_MODULE'] = 'film20.settings' from datetime import datetime from film20.import_ratings.import_ratings_helper import import_ratings import_ratings()
def handle(self, *args, **opts): import_ratings()