|
1 | 1 | import os |
2 | | -from unittest.mock import patch |
| 2 | +from unittest.mock import PropertyMock, patch |
3 | 3 |
|
4 | 4 | from uipath_langchain.chat.http_client import build_uipath_headers |
5 | 5 |
|
@@ -49,3 +49,27 @@ def test_optional_gateway_headers(self) -> None: |
49 | 49 | ) |
50 | 50 | assert headers["x-uipath-agenthub-config"] == "config-abc" |
51 | 51 | assert headers["x-uipath-llmgateway-byoisconnectionid"] == "conn-xyz" |
| 52 | + |
| 53 | + def test_licensing_context_header_present(self) -> None: |
| 54 | + with ( |
| 55 | + patch.dict(os.environ, {}, clear=True), |
| 56 | + patch( |
| 57 | + "uipath.platform.common._config.ConfigurationManager.licensing_context", |
| 58 | + new_callable=PropertyMock, |
| 59 | + return_value="robot:unattended", |
| 60 | + ), |
| 61 | + ): |
| 62 | + headers = build_uipath_headers() |
| 63 | + assert headers["x-uipath-licensing-context"] == "robot:unattended" |
| 64 | + |
| 65 | + def test_licensing_context_header_absent_when_none(self) -> None: |
| 66 | + with ( |
| 67 | + patch.dict(os.environ, {}, clear=True), |
| 68 | + patch( |
| 69 | + "uipath.platform.common._config.ConfigurationManager.licensing_context", |
| 70 | + new_callable=PropertyMock, |
| 71 | + return_value=None, |
| 72 | + ), |
| 73 | + ): |
| 74 | + headers = build_uipath_headers() |
| 75 | + assert "x-uipath-licensing-context" not in headers |
0 commit comments