예제 #1
0
  def test_source_missing_mf2(self):
    self.expect_requests_get('http://foo.com/bar', '')
    self.mox.ReplayAll()
    self.assert_error('No microformats2 data found in http://foo.com/')

    self.assertTrue(PublishedPage.get_by_id('http://foo.com/bar'))
    publish = Publish.query().get()
    self.assertEquals('failed', publish.status)
    self.assertEquals(self.source.key, publish.source)
예제 #2
0
    def test_source_missing_mf2(self):
        self.expect_requests_get('http://foo.com/bar', '')
        self.mox.ReplayAll()
        self.assert_error('No microformats2 data found in http://foo.com/')

        self.assertTrue(PublishedPage.get_by_id('http://foo.com/bar'))
        publish = Publish.query().get()
        self.assertEquals('failed', publish.status)
        self.assertEquals(self.source.key, publish.source)
예제 #3
0
 def _check_entity(self):
   self.assertTrue(PublishedPage.get_by_id('http://foo.com/bar'))
   publish = Publish.query().get()
   self.assertEquals(self.source.key, publish.source)
   self.assertEquals('complete', publish.status)
   self.assertEquals('post', publish.type)
   self.assertEquals('FakeSource post label', publish.type_label)
   expected_html = (self.post_html % 'foo') + self.backlink
   self.assertEquals(expected_html, publish.html)
   self.assertEquals({'id': 'fake id', 'url': 'http://fake/url',
                      'content': 'foo - http://foo.com/bar'},
                     publish.published)
예제 #4
0
  def test_success(self):
    html = '<article class="h-entry"><p class="e-content">foo</p></article>'
    self.expect_requests_get('http://foo.com/bar', html)
    self.mox.ReplayAll()
    self.assert_success('foo - http://foo.com/bar')

    self.assertTrue(PublishedPage.get_by_id('http://foo.com/bar'))
    publish = Publish.query().get()
    self.assertEquals(self.source.key, publish.source)
    self.assertEquals('complete', publish.status)
    self.assertEquals('post', publish.type)
    self.assertEquals('FakeSource post label', publish.type_label)
    self.assertEquals(html, publish.html)
    self.assertEquals({'id': 'fake id', 'url': 'http://fake/url',
                       'content': 'foo - http://foo.com/bar'},
                      publish.published)
예제 #5
0
 def _check_entity(self, content='foo', html_content=None):
   if html_content is None:
     html_content = content
   self.assertTrue(PublishedPage.get_by_id('http://foo.com/bar'))
   publish = Publish.query().get()
   self.assertEquals(self.source.key, publish.source)
   self.assertEquals('complete', publish.status)
   self.assertEquals('post', publish.type)
   self.assertEquals('FakeSource post label', publish.type_label)
   expected_html = (self.post_html % html_content) + self.backlink
   self.assertEquals(expected_html, publish.html)
   self.assertEquals({
     'id': 'fake id',
     'url': 'http://fake/url',
     'content': '%s - http://foo.com/bar' % content,
     'granary_message': 'granary message',
   }, publish.published)
예제 #6
0
 def _check_entity(self, content='foo', html_content=None):
     if html_content is None:
         html_content = content
     self.assertTrue(PublishedPage.get_by_id('http://foo.com/bar'))
     publish = Publish.query().get()
     self.assertEquals(self.source.key, publish.source)
     self.assertEquals('complete', publish.status)
     self.assertEquals('post', publish.type)
     self.assertEquals('FakeSource post label', publish.type_label)
     expected_html = (self.post_html % html_content) + self.backlink
     self.assertEquals(expected_html, publish.html)
     self.assertEquals(
         {
             'id': 'fake id',
             'url': 'http://fake/url',
             'content': '%s - http://foo.com/bar' % content,
             'granary_message': 'granary message',
         }, publish.published)