def make_channel(self, owner, state='N', keep_download=False): from channelguide.channels.models import Channel channel = Channel.objects.create(state=state, language=self.language, owner=owner, name=u"My Channel \u1111", url="http://myblog.com/videos/rss/" + util.random_string(20), website_url="http://myblog.com/", publisher="*****@*****.**", description=u"lots of stuff \u3333") if not keep_download: channel.download_feed = lambda: None # don't try to download feed return channel
def make_submit_data(self, dont_send=None, **extra_data): data = { 'name': 'foo', 'url': test_data_url('feed.xml'), 'website_url': 'http://foo.com/' + util.random_string(16), 'description': 'Awesome channel', 'publisher': '*****@*****.**', 'language': self.language.id, 'categories_0': self.cat1.id, 'categories_1': self.cat2.id, 'thumbnail_file': open(test_data_path('thumbnail.jpg')), 'thumbnail_file_submitted_path': '', 'adult': False, } if isinstance(dont_send, list): for key in dont_send: del data[key] elif dont_send is not None: del data[dont_send] for key, value in extra_data.items(): data[key] = value return data
def rand_path(self): return '/' + util.random_string(20)