def test_pull_version(): r = CnrClient() with requests_mock.mock() as m: response = b'package_data' m.get(DEFAULT_REGISTRY + DEFAULT_PREFIX + "/api/v1/packages/orga/p1/0.8.1/helm/pull", content=response) assert r.pull("orga/p1", { "key": "version", "value": "0.8.1" }, "helm") == response
def test_pull_digest(): r = CnrClient() with requests_mock.mock() as m: response = b'package_data' m.get(DEFAULT_REGISTRY + DEFAULT_PREFIX + "/api/v1/packages/orga/p1/blobs/sha256/2432", content=response) assert r.pull("orga/p1", { "key": "digest", "value": "2432" }, "helm") == response
def test_pull_discovery_https(discovery_html): r = CnrClient() with requests_mock.mock() as m: response = b'package_data' m.get("https://cnr.sh/?cnr-discovery=1", text=discovery_html, complete_qs=True) m.get("https://api.kubespray.io/api/v1/packages/orga/p1/pull", content=response) assert r.pull("cnr.sh/orga/p1", { "key": "version", "value": "1.0.0" }, "helm") == response
def test_pull_channel(channels_data): r = CnrClient() with requests_mock.mock() as m: response = b'package_data' m.get(DEFAULT_REGISTRY + DEFAULT_PREFIX + "/api/v1/packages/orga/p1/1.0.0-rc/helm/pull", content=response) m.get(DEFAULT_REGISTRY + DEFAULT_PREFIX + "/api/v1/packages/orga/p1/channels/dev", text=json.dumps(channels_data['dev'])) assert r.pull("orga/p1", { "value": "dev", "key": "channel" }, "helm") == response