Exemplo n.º 1
0
    def setup_class(cls):
        smtp_server = config.get('smtp.test_server')
        if smtp_server:
            host, port = smtp_server.split(':')
            port = int(port) + int(
                str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
            config['smtp.test_server'] = '%s:%s' % (host, port)

        PylonsTestCase.setup_class()
        SmtpServerHarness.setup_class()
        CreateTestData.create()

        # make 3 changes, authored by annafan
        for i in range(3):
            rev = model.repo.new_revision()
            pkg = model.Package.by_name(u'annakarenina')
            pkg.notes = u'Changed notes %i' % i
            rev.author = u'annafan'
            model.repo.commit_and_remove()

        CreateTestData.create_user('unfinisher',
                                   about='<a href="http://unfinished.tag')
        CreateTestData.create_user('uncloser',
                                   about='<a href="http://unclosed.tag">')
        CreateTestData.create_user(
            'spammer',
            about=
            u'<a href="http://mysite">mysite</a> <a href=\u201dhttp://test2\u201d>test2</a>'
        )
        CreateTestData.create_user(
            'spammer2',
            about=
            u'<a href="http://spamsite1.com\u201d>spamsite1</a>\r\n<a href="http://www.spamsite2.com\u201d>spamsite2</a>\r\n'
        )
Exemplo n.º 2
0
 def setup_class(cls):
     smtp_server = config.get("smtp.test_server")
     if smtp_server:
         host, port = smtp_server.split(":")
         port = int(port) + int(str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
         config["smtp.test_server"] = "%s:%s" % (host, port)
     SmtpServerHarness.setup_class()
     PylonsTestCase.setup_class()
Exemplo n.º 3
0
 def setup_class(cls):
     CreateTestData.create()
     cls._original_config = config.copy()
     wsgiapp = ckan.config.middleware.make_app(config['global_conf'],
                                               **config)
     cls.app = paste.fixture.TestApp(wsgiapp)
     cls.sysadmin_user = model.User.get('testsysadmin')
     PylonsTestCase.setup_class()
Exemplo n.º 4
0
 def setup_class(cls):
     CreateTestData.create()
     cls._original_config = config.copy()
     wsgiapp = ckan.config.middleware.make_app(
         config['global_conf'], **config)
     cls.app = paste.fixture.TestApp(wsgiapp)
     cls.sysadmin_user = model.User.get('testsysadmin')
     PylonsTestCase.setup_class()
 def setup_class(cls):
     smtp_server = config.get('smtp.test_server')
     if smtp_server:
         host, port = smtp_server.split(':')
         port = int(port) + int(
             str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
         config['smtp.test_server'] = '%s:%s' % (host, port)
     SmtpServerHarness.setup_class()
     PylonsTestCase.setup_class()
Exemplo n.º 6
0
 def setup_class(cls):
     CreateTestData.create()
     cls._original_config = config.copy()
     config['ckan.auth.create_user_via_web'] = True
     wsgiapp = ckan.config.middleware.make_app(
         config['global_conf'], **config)
     cls.app = helpers._get_test_app()
     cls.sysadmin_user = model.User.get('testsysadmin')
     PylonsTestCase.setup_class()
Exemplo n.º 7
0
 def setup_class(cls):
     smtp_server = config.get('smtp.test_server')
     if smtp_server:
         host, port = smtp_server.split(':')
         port = int(port) + int(str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
         config['smtp.test_server'] = '%s:%s' % (host, port)
     CreateTestData.create_user(name='bob', email='*****@*****.**')
     CreateTestData.create_user(name='mary') #NB No email addr provided
     SmtpServerHarness.setup_class()
     PylonsTestCase.setup_class()
 def setup_class(cls):
     smtp_server = config.get('smtp.test_server')
     if smtp_server:
         host, port = smtp_server.split(':')
         port = int(port) + int(
             str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
         config['smtp.test_server'] = '%s:%s' % (host, port)
     CreateTestData.create_user(name='bob', email='*****@*****.**')
     CreateTestData.create_user(name='mary')  #NB No email addr provided
     SmtpServerHarness.setup_class()
     PylonsTestCase.setup_class()
Exemplo n.º 9
0
 def setup_class(cls):
     smtp_server = config.get('smtp.test_server')
     if smtp_server:
         host, port = smtp_server.split(':')
         port = int(port) + int(str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
         config['smtp.test_server'] = '%s:%s' % (host, port)
     SmtpServerHarness.setup_class()
     PylonsTestCase.setup_class()
     umodel.setup()
     ue_model.create_table()
     cls._load_plugins()
     cls.app = hdx_test_base._get_test_app()
Exemplo n.º 10
0
    def setup_class(cls):
        smtp_server = config.get('smtp.test_server')
        if smtp_server:
            host, port = smtp_server.split(':')
            port = int(port) + int(str(hashlib.md5(cls.__name__).hexdigest())[0], 16)
            config['smtp.test_server'] = '%s:%s' % (host, port)

        PylonsTestCase.setup_class()
        SmtpServerHarness.setup_class()
        CreateTestData.create()

        # make 3 changes, authored by annafan
        for i in range(3):
            rev = model.repo.new_revision()
            pkg = model.Package.by_name(u'annakarenina')
            pkg.notes = u'Changed notes %i' % i
            rev.author = u'annafan'
            model.repo.commit_and_remove()

        CreateTestData.create_user('unfinisher', about='<a href="http://unfinished.tag')
        CreateTestData.create_user('uncloser', about='<a href="http://unclosed.tag">')
        CreateTestData.create_user('spammer', about=u'<a href="http://mysite">mysite</a> <a href=\u201dhttp://test2\u201d>test2</a>')
        CreateTestData.create_user('spammer2', about=u'<a href="http://spamsite1.com\u201d>spamsite1</a>\r\n<a href="http://www.spamsite2.com\u201d>spamsite2</a>\r\n')
Exemplo n.º 11
0
 def setup_class(cls):
     PylonsTestCase.setup_class()
     CreateTestData.create()
Exemplo n.º 12
0
 def setup_class(cls):
     PylonsTestCase.setup_class()
     CreateTestData.create()
Exemplo n.º 13
0
 def setup_class(cls):
     setup_test_search_index()
     PylonsTestCase.setup_class()
     model.repo.init_db()
     CreateTestData.create()
Exemplo n.º 14
0
    def teardown_class(cls):
        config.clear()
        config.update(cls._original_config)
        PylonsTestCase.teardown_class()

        model.repo.rebuild_db()
Exemplo n.º 15
0
 def setup_class(cls):
     setup_test_search_index()
     PylonsTestCase.setup_class()
     model.repo.init_db()
     CreateTestData.create()
Exemplo n.º 16
0
    def teardown_class(cls):
        config.clear()
        config.update(cls._original_config)
        PylonsTestCase.teardown_class()

        model.repo.rebuild_db()
Exemplo n.º 17
0
# CKAN modules
import ckan.tests.factories as factories
from ckan.tests.helpers import (FunctionalTestBase, _get_test_app)
from ckan.tests.legacy.pylons_controller import PylonsTestCase
import ckan.tests.legacy as tests
import ckan.plugins.toolkit as tk

# Nosetests module
import nose.tools as nt

call_api = tests.call_action_api

PylonsTestCase()


class TestTwitterFeeds(PylonsTestCase, FunctionalTestBase):
    def setup(self):
        super(TestTwitterFeeds, self).setup()

        self.app = _get_test_app()

    def test_resource_twitter_create(self):
        resource = factories.Resource(name='Twitter Feed',
                                      url='https://twitter.com/ckanproject',
                                      format='twitter feed')
        nt.assert_true(resource)

        nt.assert_raises(tk.ValidationError,
                         factories.Resource,
                         url='notmatchingtwitterurl.com',
                         format='twitter feed')