Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F88517148
test_cookie.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Oct 19, 06:26
Size
1 KB
Mime Type
text/x-python
Expires
Mon, Oct 21, 06:26 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21785012
Attached To
R3600 invenio-infoscience
test_cookie.py
View Options
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# Invenio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""Unit tests for Access Mail Cookies."""
from
invenio.base.wrappers
import
lazy_import
from
invenio.testsuite
import
InvenioTestCase
,
make_test_suite
,
run_test_suite
Model_parser
=
lazy_import
(
'invenio.modules.jsonalchemy.parser:ModelParser'
)
TEST_PACKAGE
=
'invenio.modules.access.testsuite'
class
TestAccMailCookie
(
InvenioTestCase
):
"""Test Mail cookie."""
def
setUp
(
self
):
"""Set up."""
pass
def
tearDown
(
self
):
"""Tear down."""
self
.
delete_objects
(
self
.
data
)
def
test_mail_cookie
(
self
):
"""Test mail cookie creation."""
from
invenio.modules.access.models
import
AccMAILCOOKIE
cookie
=
AccMAILCOOKIE
.
create
(
kind
=
'mail_activation'
,
params
=
'test@fuu.it'
,
onetime
=
True
)
ret
=
AccMAILCOOKIE
.
get
(
cookie
=
cookie
)
self
.
assertEqual
(
ret
.
data
[
0
],
'mail_activation'
)
self
.
assertEqual
(
ret
.
data
[
1
],
'test@fuu.it'
)
self
.
assertEqual
(
ret
.
data
[
3
],
True
)
self
.
assertEqual
(
ret
.
data
[
0
],
'mail_activation'
)
self
.
data
=
[
ret
]
TEST_SUITE
=
make_test_suite
(
TestAccMailCookie
)
if
__name__
==
'__main__'
:
run_test_suite
(
TEST_SUITE
)
Event Timeline
Log In to Comment