mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-25 16:31:08 -06:00
292d686c0b
Even though Pytest supports xunit style setups, unittest and nose tests, this support is limited and may be dropped in the future releases. Worst of all is that the mixing of various test frameworks results in weird conflicts and of course, is not widely tested. This is a part of work to remove the mixing of test idioms in the IPA's test suite: 1) replace xunit style 2) employ the fixtures' interdependencies Related: https://pagure.io/freeipa/issue/7989 Signed-off-by: Stanislav Levin <slev@altlinux.org> Reviewed-By: Christian Heimes <cheimes@redhat.com>
42 lines
1.1 KiB
Python
42 lines
1.1 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:
|
|
"""
|
|
Test the session storage interface
|
|
"""
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def session_storage_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
|