mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
b98f9b46de
The new marker needs_ipaapi is used to mark tests that needs an initialized API (ipalib.api) or some sort of other API services (running LDAP server) to work. Some packages use api.Command or api.Backend on module level. They are not marked but rather skipped entirely. A new option ``skip-ipaapi`` is added to skip all API based tests. With the option, only simple unit tests are executed. As of now, freeIPA contains more than 500 unit tests that can be executed in about 5 seconds. Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
#
|
|
# Copyright (C) 2017 FreeIPA Contributors see COPYING for license
|
|
#
|
|
|
|
"""
|
|
Test the `session_storage.py` module.
|
|
"""
|
|
import pytest
|
|
|
|
from ipapython import session_storage
|
|
|
|
|
|
@pytest.mark.skip_ipaclient_unittest
|
|
@pytest.mark.needs_ipaapi
|
|
class test_session_storage(object):
|
|
"""
|
|
Test the session storage interface
|
|
"""
|
|
|
|
def setup(self):
|
|
# TODO: set up test user and kinit to it
|
|
# tmpdir = tempfile.mkdtemp(prefix = "tmp-")
|
|
# os.environ['KRB5CCNAME'] = 'FILE:%s/ccache' % tmpdir
|
|
self.principal = 'admin'
|
|
self.key = 'X-IPA-test-session-storage'
|
|
self.data = b'Test Data'
|
|
|
|
def test_01(self):
|
|
session_storage.store_data(self.principal, self.key, self.data)
|
|
|
|
def test_02(self):
|
|
data = session_storage.get_data(self.principal, self.key)
|
|
assert(data == self.data)
|
|
|
|
def test_03(self):
|
|
session_storage.remove_data(self.principal, self.key)
|
|
try:
|
|
session_storage.get_data(self.principal, self.key)
|
|
except session_storage.KRB5Error:
|
|
pass
|