aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md2
-rw-r--r--tests/test_binding.py13
2 files changed, 14 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md
index 8eec718..4c9a6c6 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- Cleanup code
- Removed extraneous parentheses
+### Fixed
+- pytest fails if http\_proxy is set
## [2.3.0.] - 18/06/2021
diff --git a/tests/test_binding.py b/tests/test_binding.py
index 010c63d..6c8b0ef 100644
--- a/tests/test_binding.py
+++ b/tests/test_binding.py
@@ -17,6 +17,8 @@
# limitations under the License.
# ============LICENSE_END=========================================================
+import os
+import pytest
import requests
import httpretty
import subprocess
@@ -32,8 +34,17 @@ mr_url = 'http://mrrouter.onap.org:3904'
intopic = 'VESCOLL-VNFNJ-SECHEARTBEAT-OUTPUT'
outopic = 'POLICY-HILOTCA-EVENT-OUTPUT'
+
+@pytest.fixture()
+def disable_proxy(monkeypatch):
+ if 'http_proxy' in os.environ:
+ monkeypatch.delenv('http_proxy')
+ if 'HTTP_PROXY' in os.environ:
+ monkeypatch.delenv('HTTP_PROXY')
+
+
@httpretty.activate
-def test_resolve_all():
+def test_resolve_all(disable_proxy):
htbtmsg = '{"event":{"commonEventHeader":{"startEpochMicrosec":1518616063564475,"sourceId":"587c14b3-72c0-4581-b5cb-6567310b9bb7","eventId":"10048640","reportingEntityId":"587c14b3-72c0-4581-b5cb-6567310b9bb7","priority":"Normal","version":3,"reportingEntityName":"TESTVM","sequence":10048640,"domain":"heartbeat","lastEpochMicrosec":1518616063564476,"eventName":"Heartbeat_vVnf","sourceName":"TESTVM","nfNamingCode":"vVNF"}}}'
send_url = mr_url+'/events/'+intopic+'/DefaultGroup/1?timeout=15000'
print(send_url)