ansible/test/units
Adrian Likins af01cb114c
Support galaxy v3/autohub API in ansible-galaxy (#60982)
* Add galaxy collections API v3 support

Issue: ansible/galaxy-dev#60

- Determine if server supports v3

Use 'available_versions' from `GET /api`
to determine if 'v3' api is available on
the server.

- Support v3 pagination style

ie, 'limit/offset style', with the paginated
responses based on https://jsonapi.org/format/#fetching-pagination

v2 galaxy uses pagination that is more or less
'django rest framework style' or 'page/page_size style',
based on the default drf pagination described
at https://www.django-rest-framework.org/api-guide/pagination/#pagenumberpagination

- Support galaxy v3 style error response

The error objects returned by the galaxy v3 api are based
on the JSONAPI response/errors format
(https://jsonapi.org/format/#errors).

This handles that style response. At least for publish_collection
for now. Needs extracting/generalizing.

Handle HTTPError in CollectionRequirement.from_name()
with _handle_http_error(). It will raise AnsibleError
based on the json in an error response.

- Update unit tests

update test/unit/galaxy/test_collection*
to paramaterize calls to test against
mocked v2 and v3 servers apis.

Update artifacts_versions_json() to tale an
api version paramater.

Add error_json() for generating v3/v3 style error
responses.

So now, the urls generated and the pagination schema
of the response will use the v3 version if
the passed in GalaxyAPI 'galaxy_api' instance
has 'v3' in it's available_api_versions

* Move checking of server avail versions to collections.py

collections.py needs to know the server api versions
supported before it makes collection related calls,
so the 'lazy' server version check in api.GalaxyAPI
is never called and isn't set, so 'v3' servers weren't
found.

Update unit tests to mock the return value of the
request instead of GalaxyAPI itself.
2019-08-28 16:59:34 -04:00
..
cli ansible-galaxy - define multiple galaxy instances in ansible.cfg (#60553) 2019-08-21 07:49:05 +10:00
compat
config fixes to config manager (#58530) 2019-07-17 10:39:30 -04:00
contrib
errors
executor Support relative imports in AnsiballZ. (#61196) 2019-08-27 18:11:21 -07:00
galaxy Support galaxy v3/autohub API in ansible-galaxy (#60982) 2019-08-28 16:59:34 -04:00
inventory_test_data/group_vars
mock
module_utils Meraki - Enable API call rate limiting for requests (#54827) 2019-08-27 16:32:09 -04:00
modules Resource Module for exos_lldp_global (#60988) 2019-08-28 13:58:45 -04:00
parsing Properly JSON encode AnsibleUnsafe, using a pre-processor (#60602) 2019-08-26 09:08:22 -05:00
playbook unit tests: remove unused imports (#60462) 2019-08-13 19:21:43 +02:00
plugins win_updates: Add flag to only download updates without installing them (#58631) 2019-08-28 09:46:59 +10:00
regex
template unit tests: remove unused imports (#60462) 2019-08-13 19:21:43 +02:00
utils add subdir support to collection loading (#60682) 2019-08-21 10:45:04 +01:00
vars
__init__.py
test_constants.py
test_context.py Unit tests: remove unused imports (#59740) 2019-07-29 22:10:13 +02:00