Example #1
0
 def test_multiple_users_only_one_registered(self):
     self.source.key.delete()
     source_2 = testutil.FakeSource(id='foo.com/b',
                                    features=['publish'],
                                    domains=['foo.com'],
                                    auth_entity=self.auth_entity.key)
     source_2.put()
     source_3 = testutil.FakeSource(id='foo.com/c',
                                    features=['publish'],
                                    domains=['foo.com'],
                                    domain_urls=['http://foo.com/c'],
                                    auth_entity=self.auth_entity.key)
     source_3.put()
     self.assert_error('Publish is not enabled')
Example #2
0
 def setUp(self):
   super(SuperfeedrTest, self).setUp()
   self.source = testutil.FakeSource(id='foo.com', domains=['foo.com'],
                                     features=['webmention'])
   self.source.put()
   self.item = {'id': 'A', 'content': 'B'}
   self.feed = json.dumps({'items': [self.item]})
Example #3
0
    def test_bad_source(self):
        # no source
        self.source.key.delete()
        self.assert_error(
            'Could not find <b>FakeSource</b> account for <b>foo.com</b>.')

        # source without publish feature
        self.source.features = ['listen']
        self.source.put()
        msg = 'Publish is not enabled'
        self.assert_error(msg)

        # status disabled
        self.source.features = ['publish']
        self.source.status = 'disabled'
        self.source.put()
        self.assert_error(msg)

        # two bad sources with same domain
        source_2 = self.source = testutil.FakeSource(id='z',
                                                     **self.source.to_dict())
        source_2.status = 'enabled'
        source_2.features = ['listen']
        source_2.put()
        self.assert_error(msg)

        # one bad source, one good source, same domain. should automatically use the
        # good source.
        source_2.features.append('publish')
        source_2.put()
        self.expect_requests_get('http://foo.com/bar', self.post_html % 'xyz')
        self.mox.ReplayAll()
        self.assert_created('xyz - http://foo.com/bar')
        self.assertEquals(source_2.key, Publish.query().get().source)
Example #4
0
 def test_multiple_users_on_domain(self):
     source_2 = testutil.FakeSource(id='foo.com/b',
                                    features=['publish'],
                                    domains=['foo.com'],
                                    domain_urls=['http://foo.com/b'],
                                    auth_entity=self.auth_entity.key)
     source_2.put()
     source_3 = testutil.FakeSource(id='foo.com/c',
                                    features=['publish'],
                                    domains=['foo.com'],
                                    domain_urls=['http://foo.com/c'],
                                    auth_entity=self.auth_entity.key)
     source_3.put()
     self.expect_requests_get('http://foo.com/bar', self.post_html % 'foo')
     self.mox.ReplayAll()
     self.assert_created('foo - http://foo.com/bar', interactive=False)
     self.assertEquals(source_2.key, Publish.query().get().source)
Example #5
0
    def setUp(self):
        super(BlogWebmentionTest, self).setUp()
        self.source = testutil.FakeSource(
            id='foo.com',
            domains=['x.com', 'foo.com', 'y.com'],
            features=['webmention'])
        self.source.put()

        self.mox.StubOutWithMock(testutil.FakeSource, 'create_comment')
        self.mention_html = """\
Example #6
0
    def setUp(self):
        super(PublishTest, self).setUp()
        publish.SOURCE_NAMES['fake'] = testutil.FakeSource
        publish.SOURCE_DOMAINS['fa.ke'] = testutil.FakeSource

        self.auth_entity = testutil.FakeAuthEntity(id='0123456789')
        self.source = testutil.FakeSource(id='foo.com',
                                          features=['publish'],
                                          domains=['foo.com'],
                                          domain_urls=['http://foo.com/'],
                                          auth_entity=self.auth_entity.key)
        self.source.put()

        self.oauth_state = {
            'source_url': 'http://foo.com/bar',
            'target_url': 'https://brid.gy/publish/fake',
            'source_key': self.source.key.urlsafe(),
            'include_link': gr_source.INCLUDE_LINK,
        }
        self.post_html = '<article class="h-entry"><p class="e-content">%s</p></article>'
        self.backlink = '\n<a href="http://localhost/publish/fake"></a>'