diff --git a/MANIFEST.in b/MANIFEST.in index 167ef60..a22c890 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,12 +1,12 @@ recursive-include debian changelog compat control copyright recursive-include debian pycompat pyversions rules recursive-include debian *.dirs *.init *.postinst *.postrm *.docs *.install *.default recursive-include opensips *.cfg recursive-include scripts *.py *.sql recursive-include tls .placeholder -recursive-include xcap/test/schemas *.xsd recursive-include xcap/appusage/xml-schemas *.xsd +recursive-include test * prune debian/tmp prune debian/openxcap prune debian/python-module-stampdir include INSTALL LICENSE MANIFEST.in TODO config.ini.sample diff --git a/setup.py b/setup.py index ca31e27..8cd2cad 100644 --- a/setup.py +++ b/setup.py @@ -1,34 +1,38 @@ #!/usr/bin/env python +import os + from distutils.core import setup from xcap import __version__ +def find_packages(toplevel): + return [directory.replace(os.path.sep, '.') for directory, subdirs, files in os.walk(toplevel) if '__init__.py' in files] + setup(name = "openxcap", version = __version__, author = "Mircea Amarascu", author_email = "support@ag-projects.com", url = "http://openxcap.org/", description = "An open source XCAP server.", long_description = """XCAP protocol allows a client to read, write, and modify application configuration data stored in XML format on a server. XCAP maps XML document sub-trees and element attributes to HTTP URIs, so that these components can be directly accessed by HTTP. An XCAP server is used by the XCAP clients to store data like Presence policy in combination with a SIP Presence server that supports PUBLISH/SUBSCRIBE/NOTIFY methods to provide a complete [http://www.tech-invite.com/Ti-sip-WGs.html#wg-simple SIP SIMPLE] server solution.""", license = "GPL", platforms = ["Platform Independent"], classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Service Providers", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: POSIX :: Linux", "Programming Language :: Python", ], - packages = ['xcap', 'xcap.appusage', 'xcap.interfaces', 'xcap.interfaces.backend', 'xcap.sax', 'xcap.test'], + packages = find_packages('xcap'), scripts = ['openxcap'], - package_data = {'xcap.appusage': ['xml-schemas/*'], - 'xcap.test': ['schemas/*']}, + package_data = {'xcap.appusage': ['xml-schemas/*']}, ) diff --git a/xcap/test/__init__.py b/test/__init__.py similarity index 100% rename from xcap/test/__init__.py rename to test/__init__.py diff --git a/xcap/test/common.py b/test/common.py similarity index 100% rename from xcap/test/common.py rename to test/common.py diff --git a/xcap/test/disabled_test_subscribediff.py b/test/disabled_test_subscribediff.py similarity index 100% rename from xcap/test/disabled_test_subscribediff.py rename to test/disabled_test_subscribediff.py diff --git a/xcap/test/schemas/xcap-caps.xsd b/test/schemas/xcap-caps.xsd similarity index 100% rename from xcap/test/schemas/xcap-caps.xsd rename to test/schemas/xcap-caps.xsd diff --git a/xcap/test/schemas/xcap-error.xsd b/test/schemas/xcap-error.xsd similarity index 100% rename from xcap/test/schemas/xcap-error.xsd rename to test/schemas/xcap-error.xsd diff --git a/xcap/test/test.py b/test/test.py similarity index 100% rename from xcap/test/test.py rename to test/test.py diff --git a/xcap/test/test_attribute.py b/test/test_attribute.py similarity index 100% rename from xcap/test/test_attribute.py rename to test/test_attribute.py diff --git a/xcap/test/test_auth.py b/test/test_auth.py similarity index 100% rename from xcap/test/test_auth.py rename to test/test_auth.py diff --git a/xcap/test/test_element.py b/test/test_element.py similarity index 100% rename from xcap/test/test_element.py rename to test/test_element.py diff --git a/xcap/test/test_element_put.py b/test/test_element_put.py similarity index 100% rename from xcap/test/test_element_put.py rename to test/test_element_put.py diff --git a/xcap/test/test_errors.py b/test/test_errors.py similarity index 100% rename from xcap/test/test_errors.py rename to test/test_errors.py diff --git a/xcap/test/test_etags.py b/test/test_etags.py similarity index 100% rename from xcap/test/test_etags.py rename to test/test_etags.py diff --git a/test/test_etags2.py b/test/test_etags2.py new file mode 100644 index 0000000..e29668e --- /dev/null +++ b/test/test_etags2.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# Copyright (C) 2007-2010 AG-Projects. +# + +from common import * + +resource_list_xml = """ + + + + """ + +class ETagTest(XCAPTest): + + def test_conditional_PUT(self): + self.delete('resource-lists', status=[200,404]) + self.get('resource-lists', status=404) + + # Test conditional PUT when document doesn't exist + self.put('resource-lists', resource_list_xml, headers={'If-Match': '12345asdf'}, status=412) + +# r = self.put('resource-lists', resource_list_xml) +# etag = self.assertHeader(r, 'ETag') +# +# # Test conditional PUT logic +# ## Alice and Bob initially share the same etag +# alice_etag = bob_etag = etag +# +# ## Bob modifies the resource +# r = self.put('resource-lists', resource_list_xml, headers={'If-Match': bob_etag}) +# bob_etag = self.assertHeader(r, 'ETag') +# +# ## now Alice tries to modify the resource +# self.put('resource-lists', resource_list_xml, headers={'If-Match': alice_etag}, status=412) +# +# ## the etag has changed so now she updates her in-memory document +# r = self.get('resource-lists') +# new_alice_etag = self.assertHeader(r, 'ETag') +# self.assertEqual(bob_etag, new_alice_etag) +# +# self.put('resource-lists', resource_list_xml, headers={'If-Match': new_alice_etag}) +# + def test_conditional_PUT_2(self): + self.delete('resource-lists', status=[200,404]) + self.get('resource-lists', status=404) + + self.put('resource-lists', resource_list_xml, headers={'If-None-Match': '*'}, status=201) + self.put('resource-lists', resource_list_xml, headers={'If-None-Match': '*'}, status=412) + + +if __name__ == '__main__': + runSuiteFromModule() diff --git a/xcap/test/test_fragment.py b/test/test_fragment.py similarity index 100% rename from xcap/test/test_fragment.py rename to test/test_fragment.py diff --git a/xcap/test/test_global.py b/test/test_global.py similarity index 100% rename from xcap/test/test_global.py rename to test/test_global.py diff --git a/xcap/test/test_nsbindings.py b/test/test_nsbindings.py similarity index 100% rename from xcap/test/test_nsbindings.py rename to test/test_nsbindings.py diff --git a/xcap/test/test_pidf.py b/test/test_pidf.py similarity index 100% rename from xcap/test/test_pidf.py rename to test/test_pidf.py diff --git a/xcap/test/test_presrules.py b/test/test_presrules.py similarity index 100% rename from xcap/test/test_presrules.py rename to test/test_presrules.py diff --git a/xcap/test/test_resourcelists.py b/test/test_resourcelists.py similarity index 100% rename from xcap/test/test_resourcelists.py rename to test/test_resourcelists.py diff --git a/xcap/test/test_rlsservices.py b/test/test_rlsservices.py similarity index 100% rename from xcap/test/test_rlsservices.py rename to test/test_rlsservices.py diff --git a/xcap/test/test_watchers.py b/test/test_watchers.py similarity index 100% rename from xcap/test/test_watchers.py rename to test/test_watchers.py diff --git a/xcap/test/test_xcap_caps.py b/test/test_xcap_caps.py similarity index 100% rename from xcap/test/test_xcap_caps.py rename to test/test_xcap_caps.py diff --git a/xcap/test/test_xpath.py b/test/test_xpath.py similarity index 100% rename from xcap/test/test_xpath.py rename to test/test_xpath.py diff --git a/xcap/test/xcapclientwrap.py b/test/xcapclientwrap.py similarity index 100% rename from xcap/test/xcapclientwrap.py rename to test/xcapclientwrap.py