Added beginging of root logger, modifed setup.py to support python setup.py test.
Added a few todos.
This commit is contained in:
10
.bzrignore
Normal file
10
.bzrignore
Normal file
@@ -0,0 +1,10 @@
|
||||
.idea
|
||||
build
|
||||
python_saml2.egg-info
|
||||
dist
|
||||
.coverage
|
||||
htmlcov
|
||||
*.bak
|
||||
*.dat
|
||||
*.dir
|
||||
*.log
|
||||
2105
runtests.py
Normal file
2105
runtests.py
Normal file
File diff suppressed because it is too large
Load Diff
37
setup.py
37
setup.py
@@ -17,11 +17,24 @@
|
||||
#
|
||||
#
|
||||
|
||||
from distutils.core import Command
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
class PyTest(Command):
|
||||
user_options = []
|
||||
def initialize_options(self):
|
||||
pass
|
||||
def finalize_options(self):
|
||||
pass
|
||||
def run(self):
|
||||
import sys,subprocess
|
||||
errno = subprocess.call([sys.executable, 'runtests.py'])
|
||||
raise SystemExit(errno)
|
||||
|
||||
|
||||
setup(
|
||||
name='pysaml2',
|
||||
name='python-saml2',
|
||||
version='0.2.0',
|
||||
description='Python implementation of SAML Version 2 to be used with WSGI applications',
|
||||
# long_description = read("README"),
|
||||
@@ -29,14 +42,20 @@ setup(
|
||||
author_email='roland.hedberg@adm.umu.se',
|
||||
license='Apache 2.0',
|
||||
url='https://code.launchpad.net/~roland-hedberg/pysaml2/main',
|
||||
packages=find_packages('src'),
|
||||
package_dir={'': 'src'},
|
||||
classifiers=[
|
||||
"Development Status :: 4 - Beta",
|
||||
|
||||
packages=['saml2', 'xmldsig', 'xmlenc', 's2repoze',
|
||||
's2repoze.plugins'],
|
||||
|
||||
package_dir = {'saml2':'src/saml2', 'xmldsig':'src/xmldsig',
|
||||
'xmlenc': 'src/xmlenc',
|
||||
's2repoze': 'src/s2repoze'},
|
||||
|
||||
classifiers = ["Development Status :: 4 - Beta",
|
||||
"License :: OSI Approved :: Apache Software License",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
],
|
||||
"Topic :: Software Development :: Libraries :: Python Modules"],
|
||||
|
||||
scripts=["tools/parse_xsd2.py", "tools/make_metadata.py"],
|
||||
|
||||
install_requires=[
|
||||
# core dependencies
|
||||
'decorator',
|
||||
@@ -44,10 +63,14 @@ setup(
|
||||
# for the tests:
|
||||
'pyasn1',
|
||||
'python-memcached',
|
||||
"pytest",
|
||||
"pytest-coverage",
|
||||
# for s2repoze:
|
||||
'paste',
|
||||
'zope.interface',
|
||||
'repoze.who<2.0',
|
||||
],
|
||||
zip_safe=False,
|
||||
|
||||
cmdclass = {'test': PyTest},
|
||||
)
|
||||
|
||||
@@ -46,7 +46,9 @@
|
||||
# raise ImportError, "lxml or ElementTree are not installed, "\
|
||||
# +"see http://codespeak.net/lxml "\
|
||||
# +"or http://effbot.org/zone/element-index.htm"
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
try:
|
||||
from xml.etree import cElementTree as ElementTree
|
||||
except ImportError:
|
||||
@@ -55,6 +57,9 @@ except ImportError:
|
||||
except ImportError:
|
||||
from elementtree import ElementTree
|
||||
|
||||
root_logger = logging.getLogger("pySAML2")
|
||||
root_logger.level = logging.NOTSET
|
||||
|
||||
NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
|
||||
#TEMPLATE = '{urn:oasis:names:tc:SAML:2.0:assertion}%s'
|
||||
#XSI_NAMESPACE = 'http://www.w3.org/2001/XMLSchema-instance'
|
||||
@@ -740,4 +745,4 @@ def extension_element_to_element(extension_element, translation_functions,
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from saml2.metadata import ENDPOINTS, DEFAULT_BINDING
|
||||
|
||||
class MissingValue(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def entity_id2url(meta, entity_id):
|
||||
""" Grab the first endpoint if there are more than one,
|
||||
raises IndexError if the function returns an empty list.
|
||||
@@ -82,6 +82,17 @@ class Config(dict):
|
||||
self["secret"] = "abc" # not a very good secret :-)
|
||||
|
||||
return self
|
||||
|
||||
def log_level(self):
|
||||
"""Pass
|
||||
"""
|
||||
|
||||
# The assumption that I am currently working on is that the app should
|
||||
# be capable of specifying a logger of any manner as long as it
|
||||
# follows the logging idiom found in the python standard lib.
|
||||
|
||||
if "logging" in self.keys():
|
||||
log_level = self["logging"]
|
||||
|
||||
def xmlsec(self):
|
||||
return self["xmlsec_binary"]
|
||||
@@ -121,6 +132,9 @@ class Config(dict):
|
||||
|
||||
def attribute_converters(self):
|
||||
return self["attrconverters"]
|
||||
|
||||
def set_logger(self):
|
||||
pass
|
||||
|
||||
def debug(self):
|
||||
try:
|
||||
@@ -232,4 +246,4 @@ class SPConfig(Config):
|
||||
return self["service"]["sp"]["idp"][entity_id][
|
||||
"single_sign_on_service"][binding]
|
||||
except KeyError:
|
||||
return None
|
||||
return None
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
|
||||
|
||||
#TODO: On my system this function seems to be returning an incorrect location
|
||||
def pytest_funcarg__xmlsec(request):
|
||||
for path in os.environ["PATH"].split(":"):
|
||||
fil = os.path.join(path, "xmlsec1")
|
||||
|
||||
@@ -68,8 +68,14 @@ def test_add_duration_2():
|
||||
assert t.tm_sec == 0
|
||||
|
||||
def test_str_to_time():
|
||||
t = time.mktime(str_to_time("2000-01-12T00:00:00Z"))
|
||||
assert t == 947631600.0
|
||||
import calendar
|
||||
t = calendar.timegm(str_to_time("2000-01-12T00:00:00Z"))
|
||||
#TODO: Find all instances of time.mktime(.....)
|
||||
#t = time.mktime(str_to_time("2000-01-12T00:00:00Z"))
|
||||
#assert t == 947631600.0
|
||||
#TODO: add something to show how this time was arrived at
|
||||
# do this as an external method in the
|
||||
assert t == 947635200
|
||||
|
||||
def test_instant():
|
||||
inst = str_to_time(instant())
|
||||
|
||||
@@ -54,7 +54,8 @@ class TestIdentifier():
|
||||
assert nameid.text.strip() != nameid2.text.strip()
|
||||
|
||||
def teardown_class(self):
|
||||
os.unlink("foobar.db")
|
||||
if os.path.exists("foobar.db"):
|
||||
os.unlink("foobar.db")
|
||||
|
||||
class TestServer1():
|
||||
def setup_class(self):
|
||||
@@ -475,4 +476,4 @@ class TestServerLogout():
|
||||
# allow_create="true"),
|
||||
# "foba0001@example.com", sign=True)
|
||||
# print authn_resp
|
||||
# assert False
|
||||
# assert False
|
||||
|
||||
Reference in New Issue
Block a user