Exemplo n.º 1
0
 def test_change_url(self):
     self.login(self.ralph)
     data = self.get_default_values()
     data['url'] = test_data_url('feed2.xml')
     self.post_to_edit_page(data)
     updated = Channel.objects.get(pk=self.channel.pk)
     self.assertEquals(updated.url, test_data_url('feed2.xml'))
Exemplo n.º 2
0
 def test_change_url(self):
     self.login(self.ralph)
     data = self.get_default_values()
     data['url'] = test_data_url('feed2.xml')
     self.post_to_edit_page(data)
     updated = Channel.objects.get(pk=self.channel.pk)
     self.assertEquals(updated.url, test_data_url('feed2.xml'))
Exemplo n.º 3
0
 def submit_url(self, url=None):
     if url is None:
         url = test_data_url('feed.xml')
     if url is '':
         # this used to be an error, because URLs were required
         # now they aren't, so we use a fake URL instead
         url = test_data_url('thisdoesntexist.xml')
     return self.post_data('/submit/step1', {
         'name': 'foo',
         'url': url})
Exemplo n.º 4
0
 def test_required_fields(self):
     self.login()
     response = self.post_data('/submit/step1', {})
     form = response.context[0]['form']
     self.assertEquals(form.errors.keys(), ['url', 'name'])
     self.submit_url(test_data_url('no-thumbnail.xml'))
     should_complain = ['name', 'url', 'website_url',
             'description', 'language','categories',
             'thumbnail_file']
     response = self.post_data('/submit/step2', {})
     form = response.context[0]['form']
     self.assertSameSet(form.errors.keys(), should_complain)
Exemplo n.º 5
0
 def setUp(self):
     ChannelTestBase.setUp(self)
     self.categories = {}
     self.languages = {}
     self.tags = {}
     self.make_category("arts")
     self.make_category("tech")
     self.make_category("comedy")
     self.make_language("piglatin")
     self.make_language("klingon")
     self.channel.categories.add(self.categories['arts'])
     self.channel.categories.add(self.categories['tech'])
     self.channel.add_tag(self.ralph, u"funny\xfc")
     self.channel.add_tag(self.ralph, "awesome")
     self.channel.url = test_data_url('feed.xml')
     self.channel.update_items(
         feedparser_input=open(test_data_path('feed.xml')))
     self.channel.save()
Exemplo n.º 6
0
 def setUp(self):
     ChannelTestBase.setUp(self)
     self.categories = {}
     self.languages = {}
     self.tags = {}
     self.make_category("arts")
     self.make_category("tech")
     self.make_category("comedy")
     self.make_language("piglatin")
     self.make_language("klingon")
     self.channel.categories.add(self.categories['arts'])
     self.channel.categories.add(self.categories['tech'])
     self.channel.add_tag(self.ralph, u"funny\xfc")
     self.channel.add_tag(self.ralph, "awesome")
     self.channel.url = test_data_url('feed.xml')
     self.channel.update_items(
             feedparser_input=open(test_data_path('feed.xml')))
     self.channel.save()
Exemplo n.º 7
0
 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
Exemplo n.º 8
0
 def test_submit(self):
     self.login_and_submit_url()
     response = self.submit()
     self.check_submit_worked(response)
     stored_url = self.get_last_channel().url
     self.assertEquals(stored_url, test_data_url('feed.xml'))
Exemplo n.º 9
0
 def test_bad_url(self):
     self.login()
     response = self.submit_url('')
     self.check_submit_url_failed(response)
     response = self.submit_url(test_data_url('badfeed.html'))
     self.check_submit_url_failed(response)