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


Python HttpRequest.META['HTTP_MAIL']方法代码示例

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


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

示例1: test_vote_success_different_orgs_same_person

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_vote_success_different_orgs_same_person():
    settings.TEST_TIME = datetime(1923, 1, 3)
    place = Place(
        name="Testplace",
        description="foo",
        )
    place.save()
    e = Election(
        name="testelect",
        password="foo",
        authurl="bar",
        isopen=True,
        production=True,
        ispublic=True,
        firstpassword=True,
        secondpassword=True,
        stv=True,
        government=True,
        toelect=100,
        )
    e.save()
    p = Person(
        personnumber="1234",
        electionname=e,
        hasvoted=False,
        votestyle=0,
        hetu='foob',
        organization='tukkk.fi',
        id=1,
        )
    p.save()
    p1 = Person(
        personnumber="2345",
        electionname=e,
        hasvoted=False,
        votestyle=0,
        hetu='foob',
        organization='utu.fi',
        id=2,
        )
    p1.save()
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.post(
        '/tarkistus/commit/',
        {'number': '1234', 'organization': 'tukkk.fi', 'place': 1}
        )
    eq(response.status_code, 200)
    try:
        cont = simplejson.loads(response.content)
    except ValueError, e:
        print response.content
        raise
开发者ID:nailor,项目名称:tyy-vaali,代码行数:62,代码来源:test_views.py

示例2: test_get_person_data_error

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_get_person_data_error():
    t = Place(
        name='Testplace',
        description='Foo',
        )
    t.save()
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.post(
        '/tarkistus/whois/',
        {'number': '123',
         'organization': 'tse',
         'place': 1}
        )
    eq(response.status_code, 200)
    try:
        c = simplejson.loads(response.content)
    except ValueError, e:
        print response.content
        raise
开发者ID:nailor,项目名称:tyy-vaali,代码行数:29,代码来源:test_views.py

示例3: test_vote_different_submit

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_vote_different_submit():
    place = Place(
        name="Testplace",
        description="foo",
        )
    place.save()
    splace = Place(name='Submit')
    splace.save()
    e = Election(
        name="testelect",
        password="foo",
        authurl="bar",
        isopen=True,
        production=True,
        ispublic=True,
        firstpassword=True,
        secondpassword=True,
        stv=True,
        government=True,
        toelect=100,
        )
    e.save()
    p = Person(
        personnumber="1234",
        electionname=e,
        hasvoted=True,
        votestyle=0,
        hetu='foob',
        organization='tukkk.fi',
        id=1,
        )
    p.save()
    u = User(username='admin', password='pass')
    u.save()
    t = Ticket(
        voter=p,
        release_place=place,
        releaser=u,
        )
    t.save()
    c = Client()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.post(
        '/tarkistus/commit/',
        {'number': '1234', 'organization': 'tukkk.fi', 'place': 2}
        )
    eq(response.status_code, 200)
    try:
        c = simplejson.loads(response.content)
    except ValueError, e:
        print response.content
        raise
开发者ID:nailor,项目名称:tyy-vaali,代码行数:60,代码来源:test_views.py

示例4: test_get_person_data

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_get_person_data():
    t = Place(
        name='Testplace',
        description='Foo',
        )
    t.save()
    e = Election(
        name="testelect",
        password="foo",
        authurl="bar",
        isopen=True,
        production=True,
        ispublic=True,
        firstpassword=True,
        secondpassword=True,
        stv=True,
        government=True,
        toelect=100,
        )
    e.save()
    p = Person(
        personnumber="123",
        electionname=e,
        lastname="bar",
        firstname="foo",
        emailaddress="[email protected]",
        address="...",
        hasvoted=False,
        votestyle=1,
        hetu='foob',
        organization='tse',
        id=1,
        )
    p.save()
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.post(
        '/tarkistus/whois/',
        {'number': '123',
         'organization': 'tse',
         'place': 1,}
        )
    eq(response.status_code, 200)
    try:
        c = simplejson.loads(response.content)
    except ValueError, e:
        print response.content
        raise
开发者ID:nailor,项目名称:tyy-vaali,代码行数:57,代码来源:test_views.py

示例5: test_vote_no_ticket

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_vote_no_ticket():
    place = Place(
        name="Testplace",
        description="foo",
        )
    place.save()
    e = Election(
        name="testelect",
        password="foo",
        authurl="bar",
        isopen=True,
        production=True,
        ispublic=True,
        firstpassword=True,
        secondpassword=True,
        stv=True,
        government=True,
        toelect=100,
        )
    e.save()
    p = Person(
        personnumber="1234",
        electionname=e,
        hasvoted=True,
        votestyle=1,
        votedate=datetime(2009,1,1,18,0),
        hetu='foob',
        organization='tukkk.fi',
        id=1,
        )
    p.save()
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.post(
        '/tarkistus/commit/',
        {'number': '1234', 'organization': 'tukkk.fi', 'place': 1}
        )
    eq(response.status_code, 200)
    try:
        c = simplejson.loads(response.content)
    except ValueError:
        print repr(response.content)
        raise
    eq(
        c['errors'],
        {'__all__': ['Person has already voted.']}
        )
开发者ID:nailor,项目名称:tyy-vaali,代码行数:56,代码来源:test_views.py

示例6: test_index_get

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_index_get():
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.get('/tarkistus/')
    eq(response.status_code, 200)
开发者ID:nailor,项目名称:tyy-vaali,代码行数:14,代码来源:test_views.py

示例7: test_index_voteplace

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_index_voteplace():
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    p = Place(name='Foobarland')
    p.save()
    response = c.get('/tarkistus/')
    eq(response.status_code, 200)
    assert 'Foobarland' in response.content
开发者ID:nailor,项目名称:tyy-vaali,代码行数:17,代码来源:test_views.py

示例8: test_vote_empty_post

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_vote_empty_post():
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.post(
        '/tarkistus/commit/',
        {}
        )
    eq(response.status_code, 200)
    try:
        c = simplejson.loads(response.content)
    except ValueError, e:
        print response.content
        raise
开发者ID:nailor,项目名称:tyy-vaali,代码行数:22,代码来源:test_views.py

示例9: test_get_tickets_out

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_get_tickets_out():
    u = User(username='admin', password='pass')
    u.save()

    place = Place(name='Foobarland')
    place.save()
    e = Election(
        name="testelect",
        password="foo",
        authurl="bar",
        isopen=True,
        production=True,
        ispublic=True,
        firstpassword=True,
        secondpassword=True,
        stv=True,
        government=True,
        toelect=100,
        )
    e.save()
    p = Person(
        personnumber="42434",
        electionname=e,
        hasvoted=False,
        votestyle=0,
        hetu='foob',
        organization='tukkk.fi',
        id=1,
        )
    p.save()
    p.give_slip(place, u)
    p = Person(
        personnumber="1234",
        electionname=e,
        hasvoted=False,
        votestyle=0,
        hetu='foob',
        organization='utu.fi',
        id=2,
        )
    p.save()
    p.give_slip(place, u)
    p = Person(
        personnumber="32234",
        electionname=e,
        hasvoted=False,
        votestyle=0,
        hetu='foob',
        organization='tukkk.fi',
        id=3,
        )
    p.save()
    p.give_slip(place, u)
    c = Client()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    response = c.get('/tarkistus/list/%d/' % place.id)
    eq(response.status_code, 200)
    try:
        c = simplejson.loads(response.content)
    except ValueError:
        print response.content
        raise
    eq(len(c), 3)
    eq(c,
       [{'number': '1234', 'organization': 'utu.fi'},
        {'number': '32234', 'organization': 'tukkk.fi'},
        {'number': '42434', 'organization': 'tukkk.fi'},
        ])
开发者ID:nailor,项目名称:tyy-vaali,代码行数:76,代码来源:test_views.py

示例10: test_vote_whole_procedure

# 需要导入模块: from django.http import HttpRequest [as 别名]
# 或者: from django.http.HttpRequest import META['HTTP_MAIL'] [as 别名]
def test_vote_whole_procedure():
    place = Place(
        name="Testplace",
        description="foo",
        )
    place.save()
    e = Election(
        name="testelect",
        password="foo",
        authurl="bar",
        isopen=True,
        production=True,
        ispublic=True,
        firstpassword=True,
        secondpassword=True,
        stv=True,
        government=True,
        toelect=100,
        )
    e.save()
    p = Person(
        id=1,
        personnumber="1234",
        electionname=e,
        hasvoted=False,
        votestyle=0,
        hetu='foob',
        organization='tukkk.fi'
        )
    p.save()
    c = Client()
    User(username='admin', password='pass').save()

    fake_request = HttpRequest()
    fake_request.META['HTTP_MAIL'] = '[email protected]'
    fake_request.META['HTTP_DISPLAYNAME'] = ''
    fake_request.META['HTTP_SN'] = ''

    c.login(request=fake_request)
    settings.TEST_TIME = datetime(1900, 1, 1)
    response = c.post('/tarkistus/commit/',
                      {'number': '1234', 'organization': 'tukkk.fi', 'place': 1})
    eq(response.status_code, 200)
    eq(response.content, simplejson.dumps({'ok': 'OK. Give ticket.'}))
    t = Ticket.objects.get(
        release_place=place,
        release_time=datetime(1900, 1, 1),
        voter=p,
        submit_place=None,
        submit_time=None,
        )
    settings.TEST_TIME = datetime(1900, 1, 2)
    response = c.post('/tarkistus/commit/',
                      {'number': '1234', 'organization': 'tukkk.fi', 'place': 1})
    eq(response.status_code, 200)
    eq(response.content,
       simplejson.dumps({'ok': 'OK. Ticket can be stamped.'}))
    t = Ticket.objects.get(
        release_place=place,
        release_time=datetime(1900, 1, 1),
        voter=p,
        submit_place=place,
        submit_time=datetime(1900, 1, 2),
        )

    response = c.post('/tarkistus/commit/',
                      {'number': '1234', 'organization': 'tukkk.fi', 'place': 1})
    eq(response.status_code, 200)
    eq(response.content,
       simplejson.dumps(
            {'errors': {'__all__':
                            ['Person has voted in Testplace on 02.01.1900'+
                             ' at 00:00']}}))
    Person.objects.get(
        personnumber="1234",
        electionname=e,
        hasvoted=True,
        votestyle=1,
        hetu='foob',
        organization='tukkk.fi',
        votedate=datetime(1900, 1, 2),
        id=1,
        )
开发者ID:nailor,项目名称:tyy-vaali,代码行数:85,代码来源:test_views.py


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