Commit Graph

411 Commits

Author SHA1 Message Date
Jurko Gospodnetić 313185c9b4 marshal passed empty object optional params as empty tags
Before, passing an empty suds object as an optional parameter value was treated
the same as not passing that parameter's value or passing it None - the value
would not get marshalled into the constructed SOAP request at all.

Now, user can still not have the value marshalled by passing nothing or None,
but passing an empty object will get marshalled as an actual SOAP request XML
element.

This seems correct as passing an empty object and not passing an object are two
distinct use-cases and there are web-services out there (e.g.
`https://ads.google.com/apis/ads/publisher/v201502/LineItemService?wsdl`) that
do differentiate between the two.

Fixes issue filed on BitBucket under:
`https://bitbucket.org/jurko/suds/issues/81/suds-should-support-an-empty-object`

Kudos to Nicholas Chen (nicholaschen at BitBucket) & Mark Saniscalchi
(msaniscalchi at BitBucket) for reporting the issue and preparing the initial
fix.
2015-07-27 11:04:48 +02:00
Jurko Gospodnetić e7c3f9a419 test looking for a type in an XSD with recursive type definition 2015-07-26 15:05:32 +02:00
Jurko Gospodnetić befa968f28 tidy up test_suds.py test data & test function order (stylistic) 2015-07-26 15:02:34 +02:00
Jurko Gospodnetić 4ba2ec87cc fix test module comment typo 2015-07-26 13:51:45 +02:00
Jurko Gospodnetić 4458125828 test suds.mx.typer.Typer.getprefix()
Added basic unit tests for this function, together with some new cleanup todo
items related to the function's current implementation and test code details.
2015-07-14 11:27:40 +02:00
Jurko Gospodnetić 29f6b5917f fix handling recursive XSD imports
Now XSD import does not attempt to refetch XSD schemas already constructed
during the same XSD load operation.

Updated todo list.
Updated project release notes.
2015-07-01 11:46:19 +02:00
Jurko Gospodnetić 02c651cea2 add failing recursive XSD import test 2015-07-01 10:29:26 +02:00
Jurko Gospodnetić 1528dd0641 use six.b instead of suds.byte_str in the test_suds.py test module 2015-07-01 10:26:47 +02:00
Jurko Gospodnetić 9e16d24385 correct accidental test WSDL schema content
TestTransportUsage.test_operation_request_and_reply() test in the test_client.py
module used a WSDL schema that worked fine for that specific test case but did
not exactly match what the developer originally intended. Part of the WSDL's XSD
schema definition got formatted as an embedded Python bytes literal (b"...")
instead of a simple string, resulting in some extra 'b"' & '"' textual XML data.
The extra text data got ignored by suds when parsing that XSD but it was still
not intended to be there in the first place.

Added an assertion to catch cases where such a problem might try and sneak by us
again in the future.
2014-07-02 18:30:42 +02:00
Jurko Gospodnetić 3580611a8c tidy up test WSDL (stylistic)
- indented some of the content to make it more readable
- removed an unnecessary attributeFormDefault attribute
2014-07-01 23:51:49 +02:00
Jurko Gospodnetić 20a87b6862 add missing comment & empty line (stylistic) 2014-07-01 23:48:45 +02:00
Jurko Gospodnetić 4ee198364f correct invalid test data
Original data accepted only because of extra suds logic to support invalid XSD
schemas but neither was the data actually a valid XSD schema nor is testing that
logic the purpose of the test in question.
2014-06-30 12:07:02 +02:00
Jurko Gospodnetić 3466d461de rename __wsdl_main() recursive WSDL import test utility function
Renamed to __wsdl_no_binding() as we now have a test in its test class that does
not use this function for constructing its main WSDL schema.
2015-06-30 00:14:44 +02:00
Jurko Gospodnetić 9ae9646e3b add WSDL self import test 2015-06-30 00:11:33 +02:00
Jurko Gospodnetić a78141ada6 fix an additional broken recursive WSDL import scenario
- added related test
- fixed the issue & commented the fix
- updated related already existing comment in the original WSDL import fix
2015-06-29 23:39:51 +02:00
Jurko Gospodnetić 01524e2cfe fix comment typo 2015-06-29 21:48:36 +02:00
Jurko Gospodnetić 412be82578 refactor WSDL import related tests
All such tests were incorrectly left grouped under a class related to a more
specific use-case, and the class's description did not match its purpose.
2015-06-29 21:39:55 +02:00
Jurko Gospodnetić ab2b7a4c5c fix broken recursive WSDL imports
Suds now correctly handles twisted use-cases as seen in some M$ web services,
and whose one possible structure has been illustrated by the
test_recursive_WSDL_import() test in the test_client.py test module.

Note that this has nothing to do with recursive XSD schema imports which still
have known issues.

Updated todo list.
2015-06-29 21:31:38 +02:00
Jurko Gospodnetić 122540ec8b test resolving WSDL entity references to entities defined later in XML 2015-06-29 00:14:26 +02:00
Jurko Gospodnetić 8eeb515872 add an xfail test demonstrating a bug with recursive WSDL imports 2015-06-28 22:33:49 +02:00
Jurko Gospodnetić 0a36ee2b21 replace suds with six compatibility tools in test_client.py 2015-06-28 22:32:32 +02:00
Jurko Gospodnetić da40a0153a test referencing imported WSDL entities with same base & imported tns
Updated todo list.
2015-06-28 22:02:06 +02:00
Jurko Gospodnetić 8060225bb3 tidy up WSDL import test data & its usage
- less duplication
- test specific test data now contained in those tests
- test data can now be constructed with custom XSD target namespace
- tests depending on imported & importing WSDL target namespaces now specify
them explicitly
2015-06-28 21:57:07 +02:00
Jurko Gospodnetić 8905c666d2 add tests showing how imported WSDL entities are referenced 2015-06-28 21:35:46 +02:00
Jurko Gospodnetić a7bdabf3a4 clean up WSDL importing test data
Reduced test data duplication and made the data more parametrizable so we may
use the same data for testing more WSDL import variations.

Moved some more parts of the WSDL import test data into the imported WSDL
schema.
2015-06-28 21:11:34 +02:00
Jurko Gospodnetić e7dd8e6e51 remove invalid test_WSDL_import() test
When one WSDL imports another, this does not mean that the components from the
imported WSDL become part of the importing WSDL, but only means that importing
WSDL's components may now reference components from the imported WSDL.

The fact that suds currently imports actual components into the importing WSDL
is in fact a possible bug (unless it is just a part of some internal
implementation detail with no publicly visible side-effects, but even then such
a kludge should be made clearer in code).
2015-06-28 19:49:02 +02:00
Jurko Gospodnetić 4b9c2d3a2d fix test failure with Python 3.4.2
New Python 3.4.2 urllib implementation now explicitly closes its HTTP server
connection socket in case of any exceptions.
2014-12-25 14:23:05 +01:00
Jurko Gospodnetić 070db9f869 update XSD element tests to with corrected form_qualified expectations
Our original research was based on superficial Internet resources and lead us
down the wrong path. Reference & top-level XSD elements are always considered
qualified and that fact is not affected by any `form` or `elementFormDefault`
attribute values.
2014-06-29 20:55:49 +02:00
Jurko Gospodnetić 1ca46c5448 remove unnecessary module import 2014-06-29 18:38:23 +02:00
Jurko Gospodnetić 80f9eaac66 fix reading a reference XSD element's 'form' value
A reference XSD element's 'form' value is now correctly read from its referenced
element.

This fix:
 * fixes all tests in test_xsd_element.py previously marked as xfail,
 * corrects buggy test data in test_request_construction.py and
 * resolves project issue #49 on BitBucket.

Updated release notes.
Updated todo list.
2014-06-28 14:54:05 +02:00
Jurko Gospodnetić 0ddbb3c75f add XSD schema element related unit tests
New tests marked as expected to fail demonstrate a bug in the original suds
implementation's XSD element `form` attribute value handling. It seems that suds
uses incorrectly detects a referencing element's `form` attribute value - it
should but does not pick up the attribute value from the referenced element
instead of the referencing one (whether it is set directly or using their
schema's `elementFormDefault` attribute).

Updated todo list.
2014-06-27 20:58:11 +02:00
Jurko Gospodnetić 085165042d refactor DepList.sort() to a standalone dependency_sort() function
Renamed the suds.xsd.deplist module to suds.xsd.depsort.
Removed the DepList class and replaced its main/only functionality with a single
dependency_sort() function taking a dependency dictionary and returning the same
list that used to be returned by the DepList.sort() method.

The returned list's contents matches the items returned by the dependency
dictionary's items() method, but sorted so that dependencies come first.

Updated project release notes.

Additional included changes:
 * cleaned up the test_dependency_sort.py test module - cleanly separated
   basic tests, test utilities and test utility tests
 * added a test to make sure dependency_sort() does not modify its input data
 * documented that any entries found listed as dependencies, but that do not
   have their own dependencies listed as well, are logged & ignored
2014-06-27 16:17:25 +02:00
Jurko Gospodnetić 11b40943b6 extract dependency sort related tests from the suds.xsd.deplist module
Improved the tests in the process.
2014-06-27 01:15:50 +02:00
Jurko Gospodnetić 1810b67346 remove private member docs for suds.xsd.deplist.DepList
There private members were never intended to be a part of the class's published
interface, their docs were incorrect before the last stylistic cleanup done on
this module and the related private implementation details are planned to be
changed in the near future as well.
2014-06-26 21:18:53 +02:00
Jurko Gospodnetić 14e6f6c2ae test XSD Decimal type string representation for value zero with a negative exp 2014-06-15 22:21:11 +02:00
Jurko Gospodnetić e283fd0e7f add tests for the suds.plugin module 2014-06-15 21:53:19 +02:00
Jurko Gospodnetić 6121b75fc1 test that DocumentCache.put() operation accepts Document instances
Originally the tests were prepared based on the current DocumentCache.put()
which appears to accept only suds.sax.element.Element instances as input.
However, after reviewing the original suds project and the current suds
implementation, it seems that this is actually a suds bug and that it should
accept suds.sax.document.Document instances instead.

Without this, suds.reader.DocumentReader passes suds.sax.document.Document
instances to the cache which then get silently ignored.

The bug was introduced in one of the final commits in the original suds project
(around the end of 2011) where suds.sax.document.Document class was refactored
to no longer inherit from suds.sax.element.Element.

To maintain backward compatibility, for now we still expect to support passing
suds.sax.element.Element instances to suds.cache.DocumentCache.put() even though
it seems the rest of the suds implementation never does this.
2014-06-15 20:09:31 +02:00
Jurko Gospodnetić d172038544 test suds.sax.document.Document string conversions 2014-06-15 19:41:22 +02:00
Jurko Gospodnetić de937c00fb test suds.sax.element.Element string conversions 2014-06-15 19:27:47 +02:00
Jurko Gospodnetić 8f424659d7 add basic suds.sax.element unit tests
For now just tests:
  - basic Element construction,
  - construction name parameter handling
  - childAtPath() method

Updated todo list, including adding many new todo items related to adding new
tests.
2014-06-14 23:59:35 +02:00
Jurko Gospodnetić 6c51cdc90b correct how the current path gets passed on a sys.path to test subprocesses
We want the test subprocesses to use the same sys.path as its calling process.
However, our test subprocesses get run in a different folder so we need to
manually convert any empty-string sys.path entries to the current folder path
before passing that sys.path off to a new test subprocess.
2014-05-17 14:12:29 +02:00
Jurko Gospodnetić b58e1cc263 fix failed test subprocess reporting - add missing pytest import 2014-05-17 14:10:44 +02:00
Jurko Gospodnetić bb0aef7591 fix KeyboardInterrupt & SetupExit handling in tests/profiling/__init__.py 2014-05-17 14:09:25 +02:00
Jurko Gospodnetić 06cb88feac make tests/test_compare.sax.py a runnable script 2014-05-17 14:08:56 +02:00
Jurko Gospodnetić 1618ae351f reorganize tests - run on installed suds version + do not require py2to3
The test suite is no longer installed together with the project and can now be
run from the project's source distribution. This resolves the issue of the suds
test suite confusing users by getting installed as a top level tests package in
their Python environment.

Project to be tested now need to be explicitly installed prior to running its
tests using pytest, except in case of Python 2 tests being run from the top
level project folder. This requires the user to install the project (suggested
way is to install it in editable mode using 'pip install -e') but also allows
him to run the tests on other non-sandbox project versions, e.g. an externally
installed version.

Project testing now requires the six Python 2/3 compatibility support package
(installed automatically, together with other test requirements).
Test support code now moved to a separate testutils package located under the
tests folder.
Updated project README.rst & HACKING.rst docs.
Minor stylistic changes.
2014-05-17 14:08:18 +02:00
Jurko Gospodnetić 17033a6b91 make unsupported external tests closer to using shared Python 2/3 code
No longer ignoring KeyboardInterrupt & SystemExit exceptions in some places
when running under Python 2.4.x.
Minor stylistic changes.
2014-05-16 23:04:18 +02:00
Jurko Gospodnetić 0a34333f43 fix installation on Python 3.1 - project source files containing UTF-8 BOM
py2to3 does not support reading source files with an explicitly specified UTF-8
BOM prior to Python 3.2. This was causing errors when using it to process two
of our project files.

Updated relevant HACKING.rst documentation.
2014-05-12 11:02:17 +02:00
Jurko Gospodnetić 841255d941 correct docstring line wrapping 2014-05-11 13:33:51 +02:00
Jurko Gospodnetić 71b5bcbb86 correct stylistic comment typo 2014-04-28 14:09:48 +02:00
Jurko Gospodnetić e11d2fa5cc convert tests test_compare_sax._assert_no_output into a generic testing utility
Used for asserting that there was no captured stdout or stderr output.
2014-04-27 01:51:22 +02:00