def test_adding_movie(self): movie = Movie(title_en='Terminator ver 1', title_he=u'טרמינטור אחד' ) movie.imdb_rating = str(9.5) movie.save() self.assertEqual(unicode(movie.title_he), u'טרמינטור אחד') r = self.client.get(movie.get_absolute_url(), {}) self.assertEqual(r.status_code, 200) obj = r.context['object'] self.assertEqual(obj.title, u'Terminator ver 1') self.assertEqual(obj.title_he, u'טרמינטור אחד') self.assertEqual(obj.slug, u'terminator-ver-1') self.assertEqual(float(obj.imdb_rating), 9.5 )
sv = True print "Adding rating to %s" % (m.title) if (not m.metacritic_rating == int(mv['Metacritic'])): m.metacritic_rating = mv['Metacritic'] sv = True print "Adding metacritic to %s" % (m.title != '') if (not m.poster) & (mv['Poster'] != ''): m.poster = mv['Poster'] sv = True print "Adding poster to %s (%s)" % (m.title, mv['Poster']) if m.date.year != int(mv["Released"][0:4]): m.date = date(int(mv["Released"][0:4]), int(mv["Released"][5:7]), int(mv["Released"][8:10])) sv = True print "Adding date to %s" % (m.title) if float(m.imdb_rating) != dec2(mv['imdbRating']): m.imdb_votes = int2(mv['imdbVotes']) m.imdb_rating = dec2(mv['imdbRating']) sv = True print "Adding imdb ratings to %s" % (m.title) # else: # print "Rating okay for %s" % (m.title) if sv: m.save() saved = True except: pass if not saved: print "Skipped: %s" % mv['imdbID']