diff -Nru volatildap-1.1.0+ds.1/ChangeLog volatildap-1.2.2/ChangeLog --- volatildap-1.1.0+ds.1/ChangeLog 2017-01-17 12:22:58.000000000 +0000 +++ volatildap-1.2.2/ChangeLog 2018-08-08 10:56:39.000000000 +0000 @@ -7,6 +7,33 @@ * Add support for TLS +.. _v1.2.1: + +1.2.2 (2018-08-08) +------------------ + +*Improvements:* + + - Add support for Python 3.6, Pypy 3.5. + + +1.2.1 (2018-08-08) +------------------ + +*Packaging:* + + - Include test files in the sdist tarball. + - Use zest.releaser for releases + +.. _v1.2.0: + +1.2.0 (2018-07-28) +------------------ + +*Improvements:* + + - Add ``server.reset()``, which clears all entries except initial ones. + .. _v1.1.0: 1.1.0 (2017-01-17) diff -Nru volatildap-1.1.0+ds.1/debian/changelog volatildap-1.2.2/debian/changelog --- volatildap-1.1.0+ds.1/debian/changelog 2018-04-15 16:39:08.000000000 +0000 +++ volatildap-1.2.2/debian/changelog 2018-08-17 22:06:29.000000000 +0000 @@ -1,3 +1,12 @@ +volatildap (1.2.2-1) unstable; urgency=medium + + * New upstream release 1.2.2 + - Upstream fixed the DS issue + * d/control: + - Update Standards-Version to 4.2.0. No change required + + -- Pierre-Elliott Bécue Sat, 18 Aug 2018 00:06:29 +0200 + volatildap (1.1.0+ds.1-1) unstable; urgency=low * Initial release (Closes: #895679) diff -Nru volatildap-1.1.0+ds.1/debian/control volatildap-1.2.2/debian/control --- volatildap-1.1.0+ds.1/debian/control 2018-04-15 16:39:08.000000000 +0000 +++ volatildap-1.2.2/debian/control 2018-08-17 22:06:29.000000000 +0000 @@ -8,7 +8,7 @@ dh-python, python3-all, python3-setuptools -Standards-Version: 4.1.4 +Standards-Version: 4.2.0 Vcs-Git: https://salsa.debian.org/python-team/modules/volatildap.git Vcs-Browser: https://salsa.debian.org/python-team/modules/volatildap diff -Nru volatildap-1.1.0+ds.1/debian/copyright volatildap-1.2.2/debian/copyright --- volatildap-1.1.0+ds.1/debian/copyright 2018-04-15 16:39:08.000000000 +0000 +++ volatildap-1.2.2/debian/copyright 2018-08-17 22:06:29.000000000 +0000 @@ -1,8 +1,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: volatildap Source: https://github.com/rbarrois/volatildap -Comment: Repacked upstream tarball due to missing tests scripts. Issue - submitted upstream to ask for these tests scripts to be included. Files: * Copyright: 2016 - 2017 Raphaël Barrois diff -Nru volatildap-1.1.0+ds.1/debian/README.source volatildap-1.2.2/debian/README.source --- volatildap-1.1.0+ds.1/debian/README.source 2018-04-15 16:39:08.000000000 +0000 +++ volatildap-1.2.2/debian/README.source 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -DS release as upstream do not provide in his release the tests directory and -the tox.ini file, that would be useful for autopkgtest. diff -Nru volatildap-1.1.0+ds.1/.flake8 volatildap-1.2.2/.flake8 --- volatildap-1.1.0+ds.1/.flake8 1970-01-01 00:00:00.000000000 +0000 +++ volatildap-1.2.2/.flake8 2018-08-08 10:56:39.000000000 +0000 @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 120 diff -Nru volatildap-1.1.0+ds.1/Makefile volatildap-1.2.2/Makefile --- volatildap-1.1.0+ds.1/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ volatildap-1.2.2/Makefile 2018-08-08 10:56:39.000000000 +0000 @@ -0,0 +1,44 @@ +PACKAGE=volatildap +TESTS_DIR=tests + +FLAKE8 = flake8 + +default: + +clean: + find . -type f -name '*.pyc' -delete + find . -type f -path '*/__pycache__/*' -delete + find . -type d -empty -delete + +upgrade: + pip install --upgrade pip setuptools + pip install --upgrade -r requirements_dev.txt + pip freeze + +release: + fullrelease + +.PHONY: default clean upgrade release + +testall: + tox + +test: + python -Wdefault -m unittest discover $(TESTS_DIR) + +.PHONY: test testall + +# Note: we run the linter in two runs, because our __init__.py files has specific warnings we want to exclude +lint: flake8 isort check-manifest + +flake8: + $(FLAKE8) --config .flake8 --exclude $(PACKAGE)/__init__.py $(PACKAGE) $(TESTS_DIR) + $(FLAKE8) --config .flake8 --ignore F401 $(PACKAGE)/__init__.py + +isort: + isort $(PACKAGE) $(TESTS_DIR) --recursive --check-only --diff --project $(PACKAGE) --project $(TESTS_DIR) + +check-manifest: + check-manifest + +.PHONY: lint flake8 isort check-manifest diff -Nru volatildap-1.1.0+ds.1/MANIFEST.in volatildap-1.2.2/MANIFEST.in --- volatildap-1.1.0+ds.1/MANIFEST.in 2018-04-14 16:18:55.000000000 +0000 +++ volatildap-1.2.2/MANIFEST.in 2018-08-08 10:56:39.000000000 +0000 @@ -3,8 +3,8 @@ graft volatildap -prune tests +include Makefile tox.ini .flake8 +graft tests -global-exclude .py[cod] __pycache__ .swp +global-exclude *.py[cod] __pycache__ *.swp -exclude Makefile tox.ini .flake8 diff -Nru volatildap-1.1.0+ds.1/PKG-INFO volatildap-1.2.2/PKG-INFO --- volatildap-1.1.0+ds.1/PKG-INFO 2017-01-17 12:24:52.000000000 +0000 +++ volatildap-1.2.2/PKG-INFO 2018-08-08 10:56:39.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: volatildap -Version: 1.1.0 +Version: 1.2.2 Summary: Temporary slapd launcher for testing purposes Home-page: https://github.com/rbarrois/volatildap/ Author: Raphaël Barrois @@ -92,6 +92,10 @@ Raises ``KeyError`` if the distinguished name is unknown to the underlying database. + ``reset()`` + Restore the server to its pristine, initial state. + This includes loading the inital_data. + Configuration ------------- @@ -169,9 +173,12 @@ Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: Unix -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development Classifier: Topic :: Software Development :: Testing Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP diff -Nru volatildap-1.1.0+ds.1/README.rst volatildap-1.2.2/README.rst --- volatildap-1.1.0+ds.1/README.rst 2016-10-13 12:11:41.000000000 +0000 +++ volatildap-1.2.2/README.rst 2018-08-08 10:56:39.000000000 +0000 @@ -83,6 +83,10 @@ Raises ``KeyError`` if the distinguished name is unknown to the underlying database. +``reset()`` + Restore the server to its pristine, initial state. + This includes loading the inital_data. + Configuration ------------- diff -Nru volatildap-1.1.0+ds.1/requirements_dev.txt volatildap-1.2.2/requirements_dev.txt --- volatildap-1.1.0+ds.1/requirements_dev.txt 2016-10-13 12:09:55.000000000 +0000 +++ volatildap-1.2.2/requirements_dev.txt 2018-08-08 10:56:39.000000000 +0000 @@ -1,6 +1,8 @@ -e . +check-manifest flake8 +isort psutil -check-manifest tox +zest.releaser[recommended] diff -Nru volatildap-1.1.0+ds.1/setup.cfg volatildap-1.2.2/setup.cfg --- volatildap-1.1.0+ds.1/setup.cfg 2017-01-17 12:24:52.000000000 +0000 +++ volatildap-1.2.2/setup.cfg 2018-08-08 10:56:39.000000000 +0000 @@ -1,6 +1,13 @@ [bdist_wheel] universal = 1 +[zest.releaser] +version-levels = 3 +python-file-with-version = volatildap/version.py + +[distutils] +index-servers = pypi + [egg_info] tag_build = tag_date = 0 diff -Nru volatildap-1.1.0+ds.1/setup.py volatildap-1.2.2/setup.py --- volatildap-1.1.0+ds.1/setup.py 2016-10-13 12:09:55.000000000 +0000 +++ volatildap-1.2.2/setup.py 2018-08-08 10:56:39.000000000 +0000 @@ -2,10 +2,11 @@ # -*- coding: utf-8 -*- # This software is distributed under the two-clause BSD license. +from __future__ import unicode_literals + import codecs import os import re -import sys from setuptools import find_packages, setup @@ -13,7 +14,7 @@ def get_version(package_name): - version_re = re.compile(r"^VERSION = [\"']([\w_.-]+)[\"']$") + version_re = re.compile(r"^__version__ = [\"']([\w_.-]+)[\"']$") package_components = package_name.split('.') init_path = os.path.join(root_dir, *(package_components + ['version.py'])) with codecs.open(init_path, 'r', 'utf-8') as f: @@ -40,6 +41,7 @@ download_url="https://pypi.python.org/pypi/%s/" % PACKAGE, packages=find_packages(exclude=['tests*']), platforms=["OS Independent"], + zip_safe=False, install_requires=[ ], setup_requires=[ @@ -50,9 +52,12 @@ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: Unix", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", "Programming Language :: Python", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development", "Topic :: Software Development :: Testing", "Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP", diff -Nru volatildap-1.1.0+ds.1/tests/test_usage.py volatildap-1.2.2/tests/test_usage.py --- volatildap-1.1.0+ds.1/tests/test_usage.py 2018-04-14 13:29:38.000000000 +0000 +++ volatildap-1.2.2/tests/test_usage.py 2018-08-08 10:56:39.000000000 +0000 @@ -2,10 +2,11 @@ # This software is distributed under the two-clause BSD license. import os -import psutil import time import unittest +import psutil + import volatildap @@ -98,6 +99,41 @@ server.stop() self.assertServerStopped(context) + + +class ResetTests(LdapServerTestCase): + data = { + 'ou=test': { + 'objectClass': ['organizationalUnit'], + 'ou': ['test'], + }, + } + + def test_cleanup(self): + server, context = self._launch_server(initial_data=self.data) + extra = { + 'ou=subarea,ou=test': { + 'objectClass': ['organizationalUnit'], + }, + } + server.add(extra) + + entry = server.get('ou=subarea,ou=test,dc=example,dc=org') + server.reset() + + # Extra data should have been removed + self.assertRaises(KeyError, server.get, 'ou=subarea,ou=test,dc=example,dc=org') + + # Initial data should still be here + entry = server.get('ou=test,dc=example,dc=org') + self.assertEqual({ + 'dn': [b'ou=test,dc=example,dc=org'], + 'objectClass': [b'organizationalUnit'], + 'ou': [b'test'], + }, entry) + + server.stop() + self.assertServerStopped(context) class AutoCleanupTests(LdapServerTestCase): diff -Nru volatildap-1.1.0+ds.1/tox.ini volatildap-1.2.2/tox.ini --- volatildap-1.1.0+ds.1/tox.ini 2018-04-14 13:29:12.000000000 +0000 +++ volatildap-1.2.2/tox.ini 2018-08-08 10:56:39.000000000 +0000 @@ -1,6 +1,6 @@ [tox] envlist = - py{27,34,34} + py{27,34,35,36} lint [testenv] @@ -12,8 +12,7 @@ [testenv:lint] deps = - flake8 - check_manifest + -rrequirements_dev.txt whitelist_externals = make commands = make lint diff -Nru volatildap-1.1.0+ds.1/volatildap/server.py volatildap-1.2.2/volatildap/server.py --- volatildap-1.1.0+ds.1/volatildap/server.py 2017-01-17 12:21:29.000000000 +0000 +++ volatildap-1.2.2/volatildap/server.py 2018-08-08 10:56:39.000000000 +0000 @@ -5,7 +5,6 @@ from __future__ import unicode_literals - import base64 import codecs import logging @@ -17,10 +16,8 @@ import sys import time - from . import compat - logger = logging.getLogger(__name__.split('.')[0]) @@ -211,7 +208,13 @@ if retcode != 0: raise RuntimeError("ldapsearch failed with code %d: %r" % (retcode, stderr)) - return ldif_to_dict(stdout) + entries = ldif_to_entries(stdout) + return entries[dn] + + def reset(self): + """Reset all entries except inital ones.""" + self._clear() + self._populate() def _data_as_ldif(self, data): # Sort by dn length, thus adding parents first. @@ -307,8 +310,8 @@ if retcode != 0: raise RuntimeError("ldapsearch failed with code %d: %r" % (retcode, stderr)) - data = ldif_to_dict(stdout) - dns = [dn.decode('utf-8') for dn in data['dn']] + data = ldif_to_entries(stdout) + dns = data.keys() # Remove the furthest first dns = sorted(dns, key=lambda dn: (len(dn), dn), reverse=True) @@ -415,19 +418,27 @@ return '%s: %s' % (attr, value) -def ldif_to_dict(ldif_lines): - attributes = {} - for line in ldif_lines.decode('ascii').split('\n'): - if not line.strip(): +def ldif_to_entries(ldif_lines): + entries = {} + for entry in ldif_lines.decode('ascii').split('\n\n'): + if not entry.strip(): continue - m = re.match(r'(\w+)(:?): (.*)', line.strip()) - if m is None: - raise ValueError("Invalid line in ldif output: %r" % line) - - field, is_extended, value = m.groups() - if is_extended: - value = base64.b64decode(value.encode('ascii')) - else: - value = value.encode('ascii') - attributes.setdefault(field, []).append(value) - return attributes + + attributes = {} + for line in entry.split('\n'): + if not line.strip(): + continue + m = re.match(r'(\w+)(:?): (.*)', line.strip()) + if m is None: + raise ValueError("Invalid line in ldif output: %r" % line) + + field, is_extended, value = m.groups() + if is_extended: + value = base64.b64decode(value.encode('ascii')) + else: + value = value.encode('ascii') + attributes.setdefault(field, []).append(value) + dns = attributes.get('dn', [b'']) + assert len(dns) == 1 + entries[dns[0].decode('utf-8')] = attributes + return entries diff -Nru volatildap-1.1.0+ds.1/volatildap/version.py volatildap-1.2.2/volatildap/version.py --- volatildap-1.1.0+ds.1/volatildap/version.py 2017-01-17 12:23:11.000000000 +0000 +++ volatildap-1.2.2/volatildap/version.py 2018-08-08 10:56:39.000000000 +0000 @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- # This software is distributed under the two-clause BSD license. -VERSION = '1.1.0' +__version__ = '1.2.2' + +VERSION = __version__ diff -Nru volatildap-1.1.0+ds.1/volatildap.egg-info/not-zip-safe volatildap-1.2.2/volatildap.egg-info/not-zip-safe --- volatildap-1.1.0+ds.1/volatildap.egg-info/not-zip-safe 1970-01-01 00:00:00.000000000 +0000 +++ volatildap-1.2.2/volatildap.egg-info/not-zip-safe 2018-08-08 10:56:39.000000000 +0000 @@ -0,0 +1 @@ + diff -Nru volatildap-1.1.0+ds.1/volatildap.egg-info/PKG-INFO volatildap-1.2.2/volatildap.egg-info/PKG-INFO --- volatildap-1.1.0+ds.1/volatildap.egg-info/PKG-INFO 2017-01-17 12:24:52.000000000 +0000 +++ volatildap-1.2.2/volatildap.egg-info/PKG-INFO 2018-08-08 10:56:39.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: volatildap -Version: 1.1.0 +Version: 1.2.2 Summary: Temporary slapd launcher for testing purposes Home-page: https://github.com/rbarrois/volatildap/ Author: Raphaël Barrois @@ -92,6 +92,10 @@ Raises ``KeyError`` if the distinguished name is unknown to the underlying database. + ``reset()`` + Restore the server to its pristine, initial state. + This includes loading the inital_data. + Configuration ------------- @@ -169,9 +173,12 @@ Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: Unix -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development Classifier: Topic :: Software Development :: Testing Classifier: Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP diff -Nru volatildap-1.1.0+ds.1/volatildap.egg-info/SOURCES.txt volatildap-1.2.2/volatildap.egg-info/SOURCES.txt --- volatildap-1.1.0+ds.1/volatildap.egg-info/SOURCES.txt 2017-01-17 12:24:52.000000000 +0000 +++ volatildap-1.2.2/volatildap.egg-info/SOURCES.txt 2018-08-08 10:56:39.000000000 +0000 @@ -1,10 +1,15 @@ +.flake8 ChangeLog LICENSE MANIFEST.in +Makefile README.rst requirements_dev.txt setup.cfg setup.py +tox.ini +tests/__init__.py +tests/test_usage.py volatildap/__init__.py volatildap/compat.py volatildap/server.py @@ -12,8 +17,5 @@ volatildap.egg-info/PKG-INFO volatildap.egg-info/SOURCES.txt volatildap.egg-info/dependency_links.txt -volatildap.egg-info/top_level.txt -volatildap/__pycache__/__init__.cpython-34.pyc -volatildap/__pycache__/compat.cpython-34.pyc -volatildap/__pycache__/server.cpython-34.pyc -volatildap/__pycache__/version.cpython-34.pyc \ No newline at end of file +volatildap.egg-info/not-zip-safe +volatildap.egg-info/top_level.txt \ No newline at end of file