[Python-modules-commits] [mockldap] 01/18: Import mockldap_0.2.7.orig.tar.gz

Michael Fladischer fladi at moszumanska.debian.org
Sat Mar 18 07:30:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch experimental
in repository mockldap.

commit 9e0bc8a3f542ba798498d1ceefde5ed3f6f64314
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Fri Mar 17 20:43:25 2017 +0100

    Import mockldap_0.2.7.orig.tar.gz
---
 CHANGES                            | 12 ++++++++++++
 PKG-INFO                           | 19 ++++++++++---------
 README                             |  6 +++---
 docs/source/conf.py                |  4 ++--
 docs/source/overview.rst           | 12 ++++++------
 setup.py                           | 20 +++++++++++++-------
 src/mockldap.egg-info/PKG-INFO     | 19 ++++++++++---------
 src/mockldap.egg-info/requires.txt |  2 +-
 src/mockldap/__init__.py           |  2 ++
 src/mockldap/filter.py             |  2 ++
 src/mockldap/ldapobject.py         |  6 +++---
 src/mockldap/recording.py          |  2 ++
 src/mockldap/tests.py              | 31 +++++++++++++++++--------------
 13 files changed, 83 insertions(+), 54 deletions(-)

diff --git a/CHANGES b/CHANGES
index dc153c6..877e587 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+v0.2.7 - April 18, 2016 - attrlist
+----------------------------------
+
+- Support '*' in attrlist.
+
+
+v0.2.6 - September 29, 2015 - pyldap
+------------------------------------
+
+- Use `pyldap <https://pypi.python.org/pypi/pyldap>`_ under Python 3.
+
+
 v0.2.5 - June 16, 2015 - passwd_s
 ---------------------------------
 
diff --git a/PKG-INFO b/PKG-INFO
index 63d3255..94be487 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,29 +1,30 @@
 Metadata-Version: 1.1
 Name: mockldap
-Version: 0.2.5
+Version: 0.2.7
 Summary: A simple mock implementation of python-ldap.
 Home-page: http://bitbucket.org/psagers/mockldap/
 Author: Peter Sagerson
 Author-email: psagers.pypi at ignorare.net
 License: BSD
-Description: This project provides a mock replacement for python-ldap. It's useful for any
-        project that would like to write unit tests against LDAP code without relying on
-        a running LDAP server.
+Description: This project provides a mock replacement for python-ldap (pyldap on Python
+        3). It's useful for any project that would like to write unit tests against
+        LDAP code without relying on a running LDAP server.
         
 Keywords: mock,ldap
 Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
 Classifier: Environment :: Web Environment
-Classifier: Programming Language :: Python
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
-Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: System Administrators
-Classifier: License :: OSI Approved :: BSD License
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python
 Classifier: Topic :: Internet :: WWW/HTTP
-Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP
diff --git a/README b/README
index 65cdda3..6615e17 100644
--- a/README
+++ b/README
@@ -1,3 +1,3 @@
-This project provides a mock replacement for python-ldap. It's useful for any
-project that would like to write unit tests against LDAP code without relying on
-a running LDAP server.
+This project provides a mock replacement for python-ldap (pyldap on Python
+3). It's useful for any project that would like to write unit tests against
+LDAP code without relying on a running LDAP server.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 789e0ca..1e49183 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -59,9 +59,9 @@ copyright = u'2013, Peter Sagerson'
 # built documents.
 #
 # The short X.Y version.
-version = '0.1'
+version = '0.2'
 # The full version, including alpha/beta/rc tags.
-release = '0.2.5'
+release = '0.2.7'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/docs/source/overview.rst b/docs/source/overview.rst
index c193dc5..39668b6 100644
--- a/docs/source/overview.rst
+++ b/docs/source/overview.rst
@@ -31,12 +31,12 @@ Example
         """
         A simple test case showing off some of the basic features of mockldap.
         """
-        top = ('o=test', {'o': 'test'})
-        example = ('ou=example,o=test', {'ou': 'example'})
-        other = ('ou=other,o=test', {'ou': 'other'})
-        manager = ('cn=manager,ou=example,o=test', {'cn': 'manager', 'userPassword': ['ldaptest']})
-        alice = ('cn=alice,ou=example,o=test', {'cn': 'alice', 'userPassword': ['alicepw']})
-        bob = ('cn=bob,ou=other,o=test', {'cn': 'bob', 'userPassword': ['bobpw']})
+        top = ('o=test', {'o': ['test']})
+        example = ('ou=example,o=test', {'ou': ['example']})
+        other = ('ou=other,o=test', {'ou': ['other']})
+        manager = ('cn=manager,ou=example,o=test', {'cn': ['manager'], 'userPassword': ['ldaptest']})
+        alice = ('cn=alice,ou=example,o=test', {'cn': ['alice'], 'userPassword': ['alicepw']})
+        bob = ('cn=bob,ou=other,o=test', {'cn': ['bob'], 'userPassword': ['bobpw']})
 
         # This is the content of our mock LDAP directory. It takes the form
         # {dn: {attr: [value, ...], ...}, ...}.
diff --git a/setup.py b/setup.py
index 71a2b22..7d827f6 100755
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,12 @@
 #!/usr/bin/env python
 
+import sys
+
 from setuptools import setup
 
+
+PY3 = (sys.version_info[0] == 3)
+
 try:
     import unittest.mock    # noqa
 except ImportError:
@@ -19,7 +24,7 @@ else:
 
 setup(
     name='mockldap',
-    version='0.2.5',
+    version='0.2.7',
     description=u"A simple mock implementation of python-ldap.",
     long_description=open('README').read(),
     url='http://bitbucket.org/psagers/mockldap/',
@@ -31,23 +36,24 @@ setup(
     classifiers=[
         'Development Status :: 4 - Beta',
         'Environment :: Web Environment',
-        'Programming Language :: Python',
+        'Intended Audience :: Developers',
+        'Intended Audience :: System Administrators',
+        'License :: OSI Approved :: BSD License',
         'Programming Language :: Python :: 2',
         'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
-        'Intended Audience :: Developers',
-        'Intended Audience :: System Administrators',
-        'License :: OSI Approved :: BSD License',
+        'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python',
         'Topic :: Internet :: WWW/HTTP',
-        'Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP',
         'Topic :: Software Development :: Libraries :: Python Modules',
+        'Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP',
     ],
     keywords=['mock', 'ldap'],
     install_requires=[
-        'python-ldap',
+        'pyldap' if PY3 else 'python-ldap',
         'funcparserlib==0.3.6',
     ] + requires_mock,
     extras_require={
diff --git a/src/mockldap.egg-info/PKG-INFO b/src/mockldap.egg-info/PKG-INFO
index 63d3255..94be487 100644
--- a/src/mockldap.egg-info/PKG-INFO
+++ b/src/mockldap.egg-info/PKG-INFO
@@ -1,29 +1,30 @@
 Metadata-Version: 1.1
 Name: mockldap
-Version: 0.2.5
+Version: 0.2.7
 Summary: A simple mock implementation of python-ldap.
 Home-page: http://bitbucket.org/psagers/mockldap/
 Author: Peter Sagerson
 Author-email: psagers.pypi at ignorare.net
 License: BSD
-Description: This project provides a mock replacement for python-ldap. It's useful for any
-        project that would like to write unit tests against LDAP code without relying on
-        a running LDAP server.
+Description: This project provides a mock replacement for python-ldap (pyldap on Python
+        3). It's useful for any project that would like to write unit tests against
+        LDAP code without relying on a running LDAP server.
         
 Keywords: mock,ldap
 Platform: UNKNOWN
 Classifier: Development Status :: 4 - Beta
 Classifier: Environment :: Web Environment
-Classifier: Programming Language :: Python
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python :: 2
 Classifier: Programming Language :: Python :: 2.6
 Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
 Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
-Classifier: Intended Audience :: Developers
-Classifier: Intended Audience :: System Administrators
-Classifier: License :: OSI Approved :: BSD License
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python
 Classifier: Topic :: Internet :: WWW/HTTP
-Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP
diff --git a/src/mockldap.egg-info/requires.txt b/src/mockldap.egg-info/requires.txt
index 6304e75..bcaabc5 100644
--- a/src/mockldap.egg-info/requires.txt
+++ b/src/mockldap.egg-info/requires.txt
@@ -1,3 +1,3 @@
 python-ldap
 funcparserlib==0.3.6
-mock
\ No newline at end of file
+mock
diff --git a/src/mockldap/__init__.py b/src/mockldap/__init__.py
index 9cbe294..86aaa6d 100644
--- a/src/mockldap/__init__.py
+++ b/src/mockldap/__init__.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import, division, print_function, unicode_literals, with_statement
+
 from collections import defaultdict
 
 from ldap.cidict import cidict
diff --git a/src/mockldap/filter.py b/src/mockldap/filter.py
index 4360b20..2fec9f4 100644
--- a/src/mockldap/filter.py
+++ b/src/mockldap/filter.py
@@ -1,6 +1,8 @@
 """
 Simple filter expression parser based on funcparserlib.
 """
+from __future__ import absolute_import, division, print_function, unicode_literals, with_statement
+
 from functools import partial
 import ldap
 import re
diff --git a/src/mockldap/ldapobject.py b/src/mockldap/ldapobject.py
index 97a7b90..4c3eb3c 100644
--- a/src/mockldap/ldapobject.py
+++ b/src/mockldap/ldapobject.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import
+from __future__ import absolute_import, division, print_function, unicode_literals, with_statement
 
 import base64
 from copy import deepcopy
@@ -269,7 +269,7 @@ class LDAPObject(RecordableMethods):
                    if filter_expr.matches(dn, self.directory[dn]))
 
         # Apply attribute filtering, if any
-        if attrlist is not None:
+        if (attrlist is not None) and ('*' not in attrlist):
             results = ((dn, dict((attr, values) for attr, values in attrs.items() if attr in attrlist))
                        for dn, attrs in results)
 
@@ -292,7 +292,7 @@ class LDAPObject(RecordableMethods):
 
             if value is None:
                 value = []
-            elif type(value) is str:
+            elif not isinstance(value, list):
                 value = [value]
 
             if op == ldap.MOD_ADD:
diff --git a/src/mockldap/recording.py b/src/mockldap/recording.py
index 3796fab..344363e 100644
--- a/src/mockldap/recording.py
+++ b/src/mockldap/recording.py
@@ -1,6 +1,8 @@
 """
 Tools for recording method calls and seeding return values.
 """
+from __future__ import absolute_import, division, print_function, unicode_literals, with_statement
+
 from collections import defaultdict
 from copy import deepcopy
 from functools import partial
diff --git a/src/mockldap/tests.py b/src/mockldap/tests.py
index e2d28c4..53c09d7 100644
--- a/src/mockldap/tests.py
+++ b/src/mockldap/tests.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, print_function, unicode_literals, with_statement
 
 from copy import copy
 from doctest import DocTestSuite
@@ -144,7 +144,7 @@ class TestLDAPObject(unittest.TestCase):
     def test_search_s_base_case_insensitive(self):
         results = self.ldapobj.search_s('cn=ALICE,ou=Example,o=TEST', ldap.SCOPE_BASE)
 
-        self.assertEquals(results, [alice])
+        self.assertEqual(results, [alice])
 
     def test_search_s_get_specific_attr(self):
         results = self.ldapobj.search_s("cn=alice,ou=example,o=test", ldap.SCOPE_BASE,
@@ -152,6 +152,12 @@ class TestLDAPObject(unittest.TestCase):
 
         self.assertEqual(results, [(alice[0], {'userPassword': alice[1]['userPassword']})])
 
+    def test_search_s_get_all_attrs(self):
+        results = self.ldapobj.search_s("cn=alice,ou=example,o=test", ldap.SCOPE_BASE,
+                                        attrlist=["*"])
+
+        self.assertTrue(len(results[0][1]) > 1)
+
     def test_search_s_use_attrsonly(self):
         results = self.ldapobj.search_s("cn=alice,ou=example,o=test", ldap.SCOPE_BASE,
                                         attrlist=["userPassword"], attrsonly=1)
@@ -205,13 +211,10 @@ class TestLDAPObject(unittest.TestCase):
 
     def test_useful_seed_required_message(self):
         filterstr = '(invalid~=bogus)'
-        try:
+
+        with self.assertRaises(SeedRequired):
             self.ldapobj.search_s("ou=example,o=test", ldap.SCOPE_ONELEVEL,
                                   filterstr, attrlist=['ou'])
-        except SeedRequired as e:
-            self.assertIn("search_s('ou=example,o=test', 1, '(invalid~=bogus)', attrlist=['ou']", str(e))
-        else:
-            self.fail("Expected SeedRequired exception")
 
     def test_search_s_mixed_case_dn(self):
         dn = "cn=Edward,ou=example,o=test"
@@ -498,7 +501,7 @@ class TestLDAPObject(unittest.TestCase):
     def test_rename_s_only_rdn_append_value_to_existing_attr(self):
         self.ldapobj.rename_s(alice[0], 'uid=alice1')
 
-        self.assertEquals(
+        self.assertEqual(
             self.ldapobj.directory['uid=alice1,ou=example,o=test']['uid'],
             ['alice', 'alice1']
         )
@@ -507,8 +510,8 @@ class TestLDAPObject(unittest.TestCase):
         self.ldapobj.rename_s(alice[0], 'sn=alice1')
 
         self.assertIn('sn', self.ldapobj.directory['sn=alice1,ou=example,o=test'])
-        self.assertEquals(self.ldapobj.directory['sn=alice1,ou=example,o=test']['sn'],
-                          ['alice1'])
+        self.assertEqual(self.ldapobj.directory['sn=alice1,ou=example,o=test']['sn'],
+                         ['alice1'])
 
     def test_rename_s_removes_old_dn(self):
         self.ldapobj.rename_s(alice[0], 'uid=alice1')
@@ -598,14 +601,14 @@ class TestLDAPObject(unittest.TestCase):
 
     def test_passwd_s_no_old_password(self):
         self.ldapobj.passwd_s(alice[0], None, 'newpw')
-        self.assertEquals(self.ldapobj.directory[alice[0]]['userPassword'],
-                          ['newpw'])
+        self.assertEqual(self.ldapobj.directory[alice[0]]['userPassword'],
+                         ['newpw'])
 
     def test_passwd_s_wrong_old_password(self):
         # In case of wrong old password do nothing
         self.ldapobj.passwd_s(alice[0], 'wrong', 'newpw')
-        self.assertEquals(self.ldapobj.directory[alice[0]]['userPassword'],
-                          alice[1]['userPassword'])
+        self.assertEqual(self.ldapobj.directory[alice[0]]['userPassword'],
+                         alice[1]['userPassword'])
 
 
 def initialize(*args, **kwargs):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/mockldap.git



More information about the Python-modules-commits mailing list