当前位置: 首页>>代码示例>>Python>>正文


Python CreateTestData.create_user方法代码示例

本文整理汇总了Python中ckan.tests.legacy.CreateTestData.create_user方法的典型用法代码示例。如果您正苦于以下问题:Python CreateTestData.create_user方法的具体用法?Python CreateTestData.create_user怎么用?Python CreateTestData.create_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ckan.tests.legacy.CreateTestData的用法示例。


在下文中一共展示了CreateTestData.create_user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_perform_reset_user_password_link_key_missing

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create_user [as 别名]
 def test_perform_reset_user_password_link_key_missing(self):
     CreateTestData.create_user(name='jack', password='test1')
     user = model.User.by_name(u'jack')
     offset = url_for(controller='user',
                      action='perform_reset',
                      id=user.id)  # not, no key specified
     res = self.app.get(offset, status=403) # error
开发者ID:6779660,项目名称:ckan,代码行数:9,代码来源:test_user.py

示例2: test_perform_reset_user_password_link_key_incorrect

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create_user [as 别名]
 def test_perform_reset_user_password_link_key_incorrect(self):
     CreateTestData.create_user(name='jack', password='test1')
     # Make up a key - i.e. trying to hack this
     user = model.User.by_name(u'jack')
     offset = url_for(controller='user',
                      action='perform_reset',
                      id=user.id,
                      key='randomness') # i.e. incorrect
     res = self.app.get(offset, status=403) # error
开发者ID:6779660,项目名称:ckan,代码行数:11,代码来源:test_user.py

示例3: test_user_delete_redirects_to_user_index

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create_user [as 别名]
    def test_user_delete_redirects_to_user_index(self):
        user = CreateTestData.create_user('a_user')
        url = url_for(controller='user', action='delete', id=user.id)
        extra_environ = {'REMOTE_USER': 'testsysadmin'}

        redirect_url = url_for(controller='user', action='index',
                qualified=True)
        res = self.app.get(url, status=302, extra_environ=extra_environ)

        assert user.is_deleted(), user
        assert res.header('Location').startswith(redirect_url), res.header('Location')
开发者ID:6779660,项目名称:ckan,代码行数:13,代码来源:test_user.py

示例4: test_perform_reset_doesnt_activate_deleted_user

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create_user [as 别名]
    def test_perform_reset_doesnt_activate_deleted_user(self):
        password = 'password'
        params = { 'password1': password, 'password2': password }
        user = CreateTestData.create_user(name='deleted_user',
                                          email='[email protected]')
        user.delete()
        create_reset_key(user)
        assert user.is_deleted(), user.state

        offset = url_for(controller='user',
                         action='perform_reset',
                         id=user.id,
                         key=user.reset_key)
        res = self.app.post(offset, params=params, status=403)

        user = model.User.get(user.id)
        assert user.is_deleted(), user
开发者ID:6779660,项目名称:ckan,代码行数:19,代码来源:test_user.py

示例5: setup_class

# 需要导入模块: from ckan.tests.legacy import CreateTestData [as 别名]
# 或者: from ckan.tests.legacy.CreateTestData import create_user [as 别名]
    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()
        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')
开发者ID:PublicaMundi,项目名称:ckan,代码行数:24,代码来源:test_user.py


注:本文中的ckan.tests.legacy.CreateTestData.create_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。