• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python fixtures.get_auth函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test.fixtures.get_auth函数的典型用法代码示例。如果您正苦于以下问题:Python get_auth函数的具体用法?Python get_auth怎么用?Python get_auth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_create_spaces

def test_create_spaces():
    cookie = get_auth('thingone', 'how')
    response, content = http.request('http://0.0.0.0:8080/spaces/thing',
            method='PUT',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie})
    assert response['status'] == '201'

    response, content = http.request(
            'http://thing.0.0.0.0:8080/bags/thing_private/tiddlers/thingone',
            method='PUT',
            headers={'Content-Type': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie},
            body='{"text": "thingone"}')
    assert response['status'] == '204'

    cookie = get_auth('thingtwo', 'how')
    response, content = http.request('http://0.0.0.0:8080/spaces/foo',
            method='PUT',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie})
    assert response['status'] == '201'

    response, content = http.request(
            'http://foo.0.0.0.0:8080/bags/foo_private/tiddlers/thingtwo',
            method='PUT',
            headers={'Content-Type': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie},
            body='{"text": "thingtwo"}')
    assert response['status'] == '204'
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:28,代码来源:test_privacy.py


示例2: test_create_spaces

def test_create_spaces():
    cookie = get_auth("thingone", "how")
    response, content = http.request(
        "http://0.0.0.0:8080/spaces/thing", method="PUT", headers={"Cookie": 'tiddlyweb_user="%s"' % cookie}
    )
    assert response["status"] == "201"

    response, content = http.request(
        "http://thing.0.0.0.0:8080/bags/thing_private/tiddlers/thingone",
        method="PUT",
        headers={"Content-Type": "application/json", "Cookie": 'tiddlyweb_user="%s"' % cookie},
        body='{"text": "thingone"}',
    )
    assert response["status"] == "204"

    cookie = get_auth("thingtwo", "how")
    response, content = http.request(
        "http://0.0.0.0:8080/spaces/foo", method="PUT", headers={"Cookie": 'tiddlyweb_user="%s"' % cookie}
    )
    assert response["status"] == "201"

    response, content = http.request(
        "http://foo.0.0.0.0:8080/bags/foo_private/tiddlers/thingtwo",
        method="PUT",
        headers={"Content-Type": "application/json", "Cookie": 'tiddlyweb_user="%s"' % cookie},
        body='{"text": "thingtwo"}',
    )
    assert response["status"] == "204"
开发者ID:jdlrobson,项目名称:tiddlyspace,代码行数:28,代码来源:test_privacy.py


示例3: test_subscription

def test_subscription():
    cookie = get_auth('cdent', 'cow')
    http = httplib2.Http()
    subscriptions = simplejson.dumps({'subscriptions': ['extra']})

    response, content = http.request('http://0.0.0.0:8080/spaces/cdent',
            method='POST',
            headers={
                'Content-Type': 'application/json',
                },
            body=subscriptions)
    assert response['status'] == '403'

    response, content = http.request('http://0.0.0.0:8080/spaces/cdent',
            method='POST',
            headers={
                'Content-Type': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie,
                },
            body='')
    assert response['status'] == '409'

    response, content = http.request('http://0.0.0.0:8080/spaces/cdent',
            method='POST',
            headers={
                'Content-Type': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie,
                },
            body=subscriptions)
    assert response['status'] == '204'
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:30,代码来源:test_space_handler.py


示例4: test_register_user

def test_register_user():
    data = {'username': 'cdent', 'password': 'cowpig'}
    body = simplejson.dumps(data)
    response, content = http.request('http://0.0.0.0:8080/users',
            method='POST',
            headers={'Content-Type': 'application/json'},
            body=body)
    assert response['status'] == '201'

    response, content = http.request('http://0.0.0.0:8080/users',
            method='POST',
            headers={'Content-Type': 'application/json'},
            body=body)
    assert response['status'] == '409'
    assert 'exists' in content

    cookie = get_auth('cdent', 'cowpig')
    response, content = http.request('http://0.0.0.0:8080/spaces/cdent',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='PUT')
    assert response['status'] == '201'

    response, content = http.request('http://0.0.0.0:8080/spaces/cdent',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='PUT')
    assert response['status'] == '409'
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:26,代码来源:test_user.py


示例5: test_case_in_space

def test_case_in_space():
    cookie = get_auth('cdent', 'cow')
    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/CeXtRa',
            method='PUT',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            )
    assert response['status'] == '409'
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:8,代码来源:test_space_handler.py


示例6: test_reserved_space_name

def test_reserved_space_name():
    cookie = get_auth('cdent', 'cow')
    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/www',
            method='PUT',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            )
    assert response['status'] == '409'
    assert 'Invalid space name: www' in content
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:9,代码来源:test_space_handler.py


示例7: test_status_space_auth

def test_status_space_auth():
    user_cookie = get_auth('foo', 'foobar')
    response, content = http.request('http://thing.0.0.0.0:8080/status',
            headers={'Cookie': 'tiddlyweb_user="%s"' % user_cookie})

    assert response['status'] == '200'
    info = simplejson.loads(content)
    assert info['username'] == 'foo'
    assert info['space']['name'] == 'thing'
    assert info['space']['recipe'] == 'thing_private'
开发者ID:Erls-Corporation,项目名称:tiddlyspace,代码行数:10,代码来源:test_web_status.py


示例8: test_mutual_subscription

def test_mutual_subscription():
    """
    Subscription should not result in the same bag showing up more than once.
    """
    response, content = add_subscription('fnd', 'cdent', cookie=get_auth('cdent', 'bar'))
    assert response['status'] == '204'

    recipe = store.get(Recipe('cdent_public'))
    bags = [bag for bag, filter in recipe.get_recipe()]
    unique_bags = list(set(bags))
    assert len(bags) == len(unique_bags)
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:11,代码来源:test_subscription.py


示例9: add_subscription

def add_subscription(subscribed, subscriber, cookie=None, unsubscribe=False):
    if not cookie:
        cookie = get_auth('fnd', 'foo')
    http = httplib2.Http()
    if unsubscribe:
        subscriptions = simplejson.dumps({'unsubscriptions': [subscribed]})
    else:
        subscriptions = simplejson.dumps({'subscriptions': [subscribed]})
    return http.request('http://0.0.0.0:8080/spaces/%s' % subscriber,
        method='POST', headers={
            'Content-Type': 'application/json',
            'Cookie': 'tiddlyweb_user="%s"' % cookie,
        }, body=subscriptions)
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:13,代码来源:test_subscription.py


示例10: test_status_base_auth

def test_status_base_auth():
    user = User('foo')
    user.set_password('foobar')
    store.put(user)
    user_cookie = get_auth('foo', 'foobar')
    change_space_member(store, 'thing', add='foo')

    response, content = http.request('http://0.0.0.0:8080/status',
            headers={'Cookie': 'tiddlyweb_user="%s"' % user_cookie})

    assert response['status'] == '200'
    info = simplejson.loads(content)
    assert info['username'] == 'foo'
    assert 'space' not in info
开发者ID:Erls-Corporation,项目名称:tiddlyspace,代码行数:14,代码来源:test_web_status.py


示例11: test_delete_member

def test_delete_member():
    cookie = get_auth('fnd', 'bird')
    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members/psd',
            method='DELETE',
            )
    assert response['status'] == '403'

    response, content = http.request('http://extra.0.0.0.0:8080/spaces/extra/members/psd',
            method='DELETE',
            )
    assert response['status'] == '403'

    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members/psd',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='DELETE',
            )
    assert response['status'] == '403'

    response, content = http.request('http://extra.0.0.0.0:8080/spaces/extra/members/psd',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='DELETE',
            )
    assert response['status'] == '204'

    # delete self
    response, content = http.request('http://extra.0.0.0.0:8080/spaces/extra/members/fnd',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='DELETE',
            )
    assert response['status'] == '204'

    bag = store.get(Bag('extra_private'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == ['cdent']
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent']
    assert bag.policy.write == ['cdent']
    assert bag.policy.create == ['cdent']
    assert bag.policy.delete == ['cdent']

    bag = store.get(Bag('extra_archive'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == ['cdent']
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent']
    assert bag.policy.write == ['cdent']
    assert bag.policy.create == ['cdent']
    assert bag.policy.delete == ['cdent']
开发者ID:Hugheth,项目名称:tiddlyspace,代码行数:49,代码来源:test_space_handler.py


示例12: test_space_members

def test_space_members():
    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/cdent/members',
            method='GET')
    assert response['status'] == '401'
    cookie = get_auth('cdent', 'cow')

    response, content = http.request('http://0.0.0.0:8080/spaces/cdent/members',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='GET')
    assert response['status'] == '200'
    assert response['cache-control'] == 'no-cache'
    info = simplejson.loads(content)
    assert info == ['cdent']

    response, content = http.request('http://0.0.0.0:8080/spaces/nancy/members',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='GET')
    response['status'] == '404'
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:19,代码来源:test_space_handler.py


示例13: test_foo_tiddlers_guest

def test_foo_tiddlers_guest():
    cookie = get_auth('thingone', 'how')
    response, content = http.request('http://foo.0.0.0.0:8080/',
            method='GET',
            headers={'Accept': 'application/json'})
    guest_content = content

    response, content = http.request('http://foo.0.0.0.0:8080/',
            headers={'Accept': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie})
    user_content = content
    assert guest_content == user_content

    response, content = http.request(
            'http://thing.0.0.0.0:8080/bags/thing_private/tiddlers',
            method='GET',
            headers={'Accept': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie})
    thing_content = content

    response, content = http.request(
            'http://foo.0.0.0.0:8080/bags/thing_private/tiddlers',
            method='GET',
            headers={'Accept': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie})
    assert response['status'] == '404'

    response, content = http.request(
            'http://foo.0.0.0.0:8080/bags/thing_private/tiddlers',
            method='GET',
            headers={'Accept': 'application/json',
                'X-ControlView': 'false',
                'Cookie': 'tiddlyweb_user="%s"' % cookie})
    assert response['status'] == '401'

    response, content = http.request(
            'http://foo.0.0.0.0:8080/bags/thing_private/tiddlers/more',
            method='PUT',
            headers={'Content-Type': 'application/json',
                'X-ControlView': 'false',
                'Cookie': 'tiddlyweb_user="%s"' % cookie},
            body='{"text": "hi"}')
    assert response['status'] == '403'
开发者ID:Alanchi,项目名称:tiddlyspace,代码行数:43,代码来源:test_privacy.py


示例14: test_foo_tiddlers_guest

def test_foo_tiddlers_guest():
    cookie = get_auth("thingone", "how")
    response, content = http.request("http://foo.0.0.0.0:8080/", method="GET", headers={"Accept": "application/json"})
    guest_content = content

    response, content = http.request(
        "http://foo.0.0.0.0:8080/", headers={"Accept": "application/json", "Cookie": 'tiddlyweb_user="%s"' % cookie}
    )
    user_content = content
    assert guest_content == user_content

    response, content = http.request(
        "http://thing.0.0.0.0:8080/bags/thing_private/tiddlers",
        method="GET",
        headers={"Accept": "application/json", "Cookie": 'tiddlyweb_user="%s"' % cookie},
    )
    thing_content = content

    response, content = http.request(
        "http://foo.0.0.0.0:8080/bags/thing_private/tiddlers",
        method="GET",
        headers={"Accept": "application/json", "Cookie": 'tiddlyweb_user="%s"' % cookie},
    )
    assert response["status"] == "404"

    response, content = http.request(
        "http://foo.0.0.0.0:8080/bags/thing_private/tiddlers",
        method="GET",
        headers={"Accept": "application/json", "X-ControlView": "false", "Cookie": 'tiddlyweb_user="%s"' % cookie},
    )
    assert response["status"] == "401"

    response, content = http.request(
        "http://foo.0.0.0.0:8080/bags/thing_private/tiddlers/more",
        method="PUT",
        headers={
            "Content-Type": "application/json",
            "X-ControlView": "false",
            "Cookie": 'tiddlyweb_user="%s"' % cookie,
        },
        body='{"text": "hi"}',
    )
    assert response["status"] == "403"
开发者ID:jdlrobson,项目名称:tiddlyspace,代码行数:43,代码来源:test_privacy.py


示例15: test_blacklisted_subscription

def test_blacklisted_subscription():
    cookie = get_auth('cdent', 'cow')
    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/scrappy',
            method='PUT',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            )
    assert response['status'] == '201'

    subscriptions = simplejson.dumps({'subscriptions': ['scrappy']})

    response, content = http.request('http://0.0.0.0:8080/spaces/cdent',
            method='POST',
            headers={
                'Content-Type': 'application/json',
                'Cookie': 'tiddlyweb_user="%s"' % cookie,
                },
            body=subscriptions)
    assert response['status'] == '409'
    assert 'Subscription not allowed to space: scrappy' in content
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:20,代码来源:test_space_handler.py


示例16: test_chars_in_space

def test_chars_in_space():
    testcases = [
        ('foo', '201'),
        ('bAr', '409'),
        ('f0o', '201'),
        ('fo0', '201'),
        ('0foo', '201'),
        ('foo-bar', '201'),
        ('foo-bar-baz', '201'),
        ('-foo', '409'),
        ('foo-', '409'),
    ]

    cookie = get_auth('cdent', 'cow')
    http = httplib2.Http()
    for name, status in testcases:
        response, content = http.request('http://0.0.0.0:8080/spaces/%s' % name,
                method='PUT',
                headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
                )
        assert response['status'] == status
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:21,代码来源:test_space_handler.py


示例17: test_create_space

def test_create_space():
    cookie = get_auth('cdent', 'cow')
    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/cdent',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='PUT')
    assert response['status'] == '409'

    response, content = http.request('http://0.0.0.0:8080/spaces/extra',
            method='GET')
    assert response['status'] == '404'

    response, content = http.request('http://0.0.0.0:8080/spaces/extra',
            method='PUT')
    assert response['status'] == '403'

    response, content = http.request('http://0.0.0.0:8080/spaces/extra',
            method='PUT',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            )
    assert response['status'] == '201'
    assert response['location'] == 'http://extra.0.0.0.0:8080/'

    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='GET')
    response['status'] == '200'
    info = simplejson.loads(content)
    assert info == ['cdent'], content

    bag = store.get(Bag('extra_public'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == []
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent']
    assert bag.policy.write == ['cdent']
    assert bag.policy.create == ['cdent']
    assert bag.policy.delete == ['cdent']

    bag = store.get(Bag('extra_private'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == ['cdent']
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent']
    assert bag.policy.write == ['cdent']
    assert bag.policy.create == ['cdent']
    assert bag.policy.delete == ['cdent']

    bag = store.get(Bag('extra_archive'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == ['cdent']
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent']
    assert bag.policy.write == ['cdent']
    assert bag.policy.create == ['cdent']
    assert bag.policy.delete == ['cdent']

    recipe = store.get(Recipe('extra_public'))
    assert recipe.policy.owner == 'cdent'
    assert recipe.policy.read == []
    assert recipe.policy.accept == ['NONE']
    assert recipe.policy.manage == ['cdent']
    assert recipe.policy.write == ['cdent']
    assert recipe.policy.create == ['cdent']
    assert recipe.policy.delete == ['cdent']
    recipe_list = recipe.get_recipe()
    assert len(recipe_list) == 7
    assert recipe_list[0][0] == 'system'
    assert recipe_list[1][0] == 'tiddlyspace'
    assert recipe_list[2][0] == 'system-plugins_public'
    assert recipe_list[3][0] == 'system-info_public'
    assert recipe_list[4][0] == 'system-images_public'
    assert recipe_list[5][0] == 'system-theme_public'
    assert recipe_list[6][0] == 'extra_public'

    recipe = store.get(Recipe('extra_private'))
    recipe_list = recipe.get_recipe()
    assert recipe.policy.owner == 'cdent'
    assert recipe.policy.read == ['cdent']
    assert recipe.policy.accept == ['NONE']
    assert recipe.policy.manage == ['cdent']
    assert recipe.policy.write == ['cdent']
    assert recipe.policy.create == ['cdent']
    assert recipe.policy.delete == ['cdent']
    assert len(recipe_list) == 8
    assert recipe_list[0][0] == 'system'
    assert recipe_list[1][0] == 'tiddlyspace'
    assert recipe_list[2][0] == 'system-plugins_public'
    assert recipe_list[3][0] == 'system-info_public'
    assert recipe_list[4][0] == 'system-images_public'
    assert recipe_list[5][0] == 'system-theme_public'
    assert recipe_list[6][0] == 'extra_public'
    assert recipe_list[7][0] == 'extra_private'
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:93,代码来源:test_space_handler.py


示例18: test_space_not_expose_subscription_recipes

def test_space_not_expose_subscription_recipes():
    make_fake_space(store, 'foo')
    make_fake_space(store, 'bar')
    make_fake_space(store, 'baz')

    # add subscription (manual as this is currently insufficiently encapsulated)
    public_recipe = store.get(Recipe('foo_public'))
    private_recipe = store.get(Recipe('foo_private'))
    public_recipe_list = public_recipe.get_recipe()
    private_recipe_list = private_recipe.get_recipe()
    public_recipe_list.insert(-1, ('bar_public', ''))
    private_recipe_list.insert(-2, ('bar_public', ''))
    public_recipe.set_recipe(public_recipe_list)
    private_recipe.set_recipe(private_recipe_list)
    store.put(public_recipe)
    store.put(private_recipe)

    http = httplib2.Http()

    user = User('foo')
    user.set_password('foobar')
    store.put(user)
    user_cookie = get_auth('foo', 'foobar')

    response, content = http.request('http://foo.0.0.0.0:8080/recipes',
            method='GET')

    assert response['status'] == '200'
    assert 'foo_public' in content, content
    assert 'foo_private' not in content, content # not auth'd
    assert 'bar_public' not in content, content
    assert 'bar_private' not in content, content
    assert 'baz_' not in content, content

    response, content = http.request('http://foo.0.0.0.0:8080/recipes/foo_public',
            method='GET')
    assert response['status'] == '200'

    response, content = http.request('http://foo.0.0.0.0:8080/recipes/foo_private',
            method='GET',
            headers={
                'Cookie': 'tiddlyweb_user="%s"' % user_cookie
            })
    assert response['status'] == '200'

    response, content = http.request('http://foo.0.0.0.0:8080/recipes/bar_public',
            method='GET')
    assert response['status'] == '404'

    response, content = http.request('http://foo.0.0.0.0:8080/recipes/bar_private',
            method='GET',
            headers={
                'Cookie': 'tiddlyweb_user="%s"' % user_cookie
            })
    assert response['status'] == '404'

    response, content = http.request('http://foo.0.0.0.0:8080/recipes/baz_public',
            method='GET')
    assert response['status'] == '404'

    response, content = http.request('http://foo.0.0.0.0:8080/recipes/baz_private',
            method='GET')
    assert response['status'] == '404'
开发者ID:dahukanna,项目名称:tiddlyspace,代码行数:63,代码来源:test_web_use_instance.py


示例19: test_add_a_member

def test_add_a_member():
    cookie = get_auth('cdent', 'cow')
    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members/fnd',
            method='PUT',
            )
    assert response['status'] == '403'

    http = httplib2.Http()
    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members/fnd',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='PUT',
            )
    assert response['status'] == '204'

    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='GET')
    assert response['status'] == '200', content
    info = simplejson.loads(content)
    assert info == ['cdent', 'fnd']

    bag = store.get(Bag('extra_private'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == ['cdent', 'fnd']
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent', 'fnd']
    assert bag.policy.write == ['cdent', 'fnd']
    assert bag.policy.create == ['cdent', 'fnd']
    assert bag.policy.delete == ['cdent', 'fnd']

    bag = store.get(Bag('extra_archive'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == ['cdent', 'fnd']
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent', 'fnd']
    assert bag.policy.write == ['cdent', 'fnd']
    assert bag.policy.create == ['cdent', 'fnd']
    assert bag.policy.delete == ['cdent', 'fnd']

    bag = store.get(Bag('extra_public'))
    assert bag.policy.owner == 'cdent'
    assert bag.policy.read == []
    assert bag.policy.accept == ['NONE']
    assert bag.policy.manage == ['cdent', 'fnd']
    assert bag.policy.write == ['cdent', 'fnd']
    assert bag.policy.create == ['cdent', 'fnd']
    assert bag.policy.delete == ['cdent', 'fnd']

    # authed user not in space may not add people
    cookie = get_auth('psd', 'cat')
    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members/psd',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='PUT',
            )
    assert response['status'] == '403'

    cookie = get_auth('fnd', 'bird')
    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members/psd',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='PUT',
            )
    assert response['status'] == '204'

    cookie = get_auth('fnd', 'bird')
    response, content = http.request('http://0.0.0.0:8080/spaces/extra/members/mary',
            headers={'Cookie': 'tiddlyweb_user="%s"' % cookie},
            method='PUT',
            )
    assert response['status'] == '409'
开发者ID:EnoX1,项目名称:tiddlyspace,代码行数:70,代码来源:test_space_handler.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fixtures.make_fake_space函数代码示例发布时间:2022-05-27
下一篇:
Python fixture.read_yaml函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap