Enable Adapter to work behind proxy
[dcaegen2/platform.git] / adapter / acumos / tests / test_docker.py
index 2f618e6..bee53a0 100644 (file)
@@ -3,6 +3,8 @@
 # =============================================================================
 # Copyright (c) 2019 AT&T Intellectual Property. All rights reserved.
 # =============================================================================
+# Copyright (c) 2021 highstreet technologies GmbH. 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.
 # You may obtain a copy of the License at
@@ -25,7 +27,7 @@ TEST_META = get_json_fixture("models/example-model/metadata.json")
 
 def test_generate_dockerfile():
     assert (
-        docker_gen._generate_dockerfile(TEST_META, "example-model")
+        docker_gen._generate_dockerfile(TEST_META, "example-model", '', '', '')
         == """
     FROM python:3.6.8
 
@@ -35,7 +37,12 @@ def test_generate_dockerfile():
 
     ADD ./example-model /app/example-model
     ADD ./requirements.txt /app
-
+    ENV http_proxy=
+    ENV https_proxy=
+    ENV HTTP_PROXY=
+    ENV HTTPS_PROXY=
+    ENV no_proxy=
+    ENV NO_PROXY=
     RUN pip install -r /app/requirements.txt && \
         pip install acumos_dcae_model_runner
 
@@ -50,6 +57,6 @@ def test_generate_dockerfile():
 
 def test_build_and_push_docker(monkeypatch):
     model_repo_path = get_fixture_path('models')
-    config = scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword', tmpdir=model_repo_path)
+    config = scanner.Config(dcaeurl='http://dcaeurl', dcaeuser='dcaeuser', onboardingurl='https://onboarding', onboardinguser='obuser', onboardingpass='obpass', acumosurl='https://acumos', certfile=None, dockerregistry='dockerregistry', dockeruser='registryuser', dockerpass='registrypassword', http_proxy='', https_proxy='', no_proxy='', tmpdir=model_repo_path)
     monkeypatch.setattr(docker_gen, 'APIClient', test_fed._mockdocker.APIClient)
     assert(docker_gen.build_and_push_docker(config, 'example-model', model_version="latest") == 'dockerregistry/example-model:latest')