diff options
author | Hansen, Tony (th1395) <th1395@att.com> | 2022-08-05 22:16:14 +0000 |
---|---|---|
committer | Hansen, Tony (th1395) <th1395@att.com> | 2022-08-17 22:10:23 +0000 |
commit | c83d2369eb2f0ac40d5acd2db2d7350fe86101e5 (patch) | |
tree | d4549e4aca7248f63a0417d6718a1cfb8445a1ea /mod/distributorapi/distributor/registry_client.py | |
parent | 2b31b78fb0c6621259898c3553187be4ab0acf8a (diff) |
codecoverage improvement
Change-Id: I69cdb741c1e07a096ddd7c85921326070fb08a92
Signed-off-by: Hansen, Tony (th1395) <th1395@att.com>
Issue-ID: DCAEGEN2-3170
Signed-off-by: Hansen, Tony (th1395) <th1395@att.com>
Diffstat (limited to 'mod/distributorapi/distributor/registry_client.py')
-rw-r--r-- | mod/distributorapi/distributor/registry_client.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mod/distributorapi/distributor/registry_client.py b/mod/distributorapi/distributor/registry_client.py index 5d437e7..372099a 100644 --- a/mod/distributorapi/distributor/registry_client.py +++ b/mod/distributorapi/distributor/registry_client.py @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2019-2022 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ def _add_url_from_link(registry_url, obj): for k, v in obj.items(): if k == "link": - result["selfUrl"] =_urljoin(registry_url, v["href"]) + result["selfUrl"] = _urljoin(registry_url, v["href"]) result[k] = v elif type(v) == dict: result[k] = _add_url_from_link(registry_url, v) @@ -63,13 +63,14 @@ def get_flow_versions(flow_url): """Returns list of versions from greatest to least for a given flow""" versions_url = _urljoin(flow_url, "versions") # List of versions will be greatest to least - return list(reversed(sorted( - [v["version"] for v in _get_json(versions_url)]))) + return list(reversed(sorted([v["version"] for v in _get_json(versions_url)]))) + def get_flow_diff(registry_url, flow_url, version_one, version_two): diff_url = _urljoin(flow_url, "diff", str(version_one), str(version_two)) return _get_json(diff_url) + def get_flow_diff_latest(registry_url, flow_url): versions = get_flow_versions(flow_url) @@ -80,12 +81,13 @@ def get_flow_diff_latest(registry_url, flow_url): return None else: # Example in gitlab wiki shows that lower version is first - return _add_url_from_link(registry_url - , get_flow_diff(registry_url, flow_url, versions[1], versions[0])) + return _add_url_from_link(registry_url, get_flow_diff(registry_url, flow_url, versions[1], versions[0])) + def get_flow_version(registry_url, flow_url, version): version_url = _urljoin(flow_url, "versions", str(version)) return _add_url_from_link(registry_url, _get_json(version_url)) + def get_flow_version_latest(registry_url, flow_url): return get_flow_version(registry_url, flow_url, "latest") |