besapi 4.0.2__tar.gz → 4.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {besapi-4.0.2/src/besapi.egg-info → besapi-4.1.2}/PKG-INFO +1 -1
  2. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/besapi.py +7 -4
  3. {besapi-4.0.2 → besapi-4.1.2/src/besapi.egg-info}/PKG-INFO +1 -1
  4. {besapi-4.0.2 → besapi-4.1.2}/tests/test_besapi.py +52 -0
  5. {besapi-4.0.2 → besapi-4.1.2}/LICENSE.txt +0 -0
  6. {besapi-4.0.2 → besapi-4.1.2}/MANIFEST.in +0 -0
  7. {besapi-4.0.2 → besapi-4.1.2}/README.md +0 -0
  8. {besapi-4.0.2 → besapi-4.1.2}/pyproject.toml +0 -0
  9. {besapi-4.0.2 → besapi-4.1.2}/setup.cfg +0 -0
  10. {besapi-4.0.2 → besapi-4.1.2}/setup.py +0 -0
  11. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/__init__.py +0 -0
  12. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/__main__.py +0 -0
  13. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/plugin_utilities.py +0 -0
  14. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/plugin_utilities_win.py +0 -0
  15. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/schemas/BES.xsd +0 -0
  16. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/schemas/BESAPI.xsd +0 -0
  17. {besapi-4.0.2 → besapi-4.1.2}/src/besapi/schemas/BESActionSettings.xsd +0 -0
  18. {besapi-4.0.2 → besapi-4.1.2}/src/besapi.egg-info/SOURCES.txt +0 -0
  19. {besapi-4.0.2 → besapi-4.1.2}/src/besapi.egg-info/dependency_links.txt +0 -0
  20. {besapi-4.0.2 → besapi-4.1.2}/src/besapi.egg-info/requires.txt +0 -0
  21. {besapi-4.0.2 → besapi-4.1.2}/src/besapi.egg-info/top_level.txt +0 -0
  22. {besapi-4.0.2 → besapi-4.1.2}/src/bescli/__init__.py +0 -0
  23. {besapi-4.0.2 → besapi-4.1.2}/src/bescli/__main__.py +0 -0
  24. {besapi-4.0.2 → besapi-4.1.2}/src/bescli/bescli.py +0 -0
  25. {besapi-4.0.2 → besapi-4.1.2}/tests/test_plugin_utilities.py +0 -0
  26. {besapi-4.0.2 → besapi-4.1.2}/tests/test_plugin_utilities_logging.py +0 -0
  27. {besapi-4.0.2 → besapi-4.1.2}/tests/tests.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: besapi
3
- Version: 4.0.2
3
+ Version: 4.1.2
4
4
  Summary: Library for working with the BigFix REST API
5
5
  Home-page: https://github.com/jgstew/besapi
6
6
  Author: Matt Hansen, James Stewart
@@ -29,7 +29,7 @@ import lxml.objectify
29
29
  import requests
30
30
  import urllib3.poolmanager
31
31
 
32
- __version__ = "4.0.2"
32
+ __version__ = "4.1.2"
33
33
 
34
34
  besapi_logger = logging.getLogger("besapi")
35
35
 
@@ -357,14 +357,17 @@ def get_bes_conn_interactive(
357
357
  try:
358
358
  return BESConnection(user, password, root_server)
359
359
  except requests.exceptions.HTTPError as err:
360
- print("Bad Password, Try again!")
360
+ print("Bad Username or Bad Password, Try again!")
361
361
  logging.debug(err)
362
+ print(" BES_ROOT_SERVER: ", root_server)
362
363
  return get_bes_conn_interactive(
363
- user=user, password=None, root_server=root_server, force_prompt=force_prompt
364
+ user=None, password=None, root_server=root_server, force_prompt=force_prompt
364
365
  )
365
366
  except requests.exceptions.ConnectionError as err:
366
367
  print("Bad Root Server Specified, Try again!")
367
368
  logging.debug("Connection Error: %s", err)
369
+ print(" BES_USER_NAME: ", user)
370
+ print("BES_PASSWORD length: ", len(password))
368
371
  return get_bes_conn_interactive(
369
372
  user=user, password=password, root_server=None, force_prompt=force_prompt
370
373
  )
@@ -612,7 +615,7 @@ class BESConnection:
612
615
  return RESTResult(
613
616
  self.session.post(
614
617
  self.url("query"),
615
- data=f"relevance={urllib.parse.quote(relevance, safe=':+')}",
618
+ data=f"relevance={urllib.parse.quote(relevance, safe=':')}",
616
619
  verify=self.verify,
617
620
  **kwargs,
618
621
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: besapi
3
- Version: 4.0.2
3
+ Version: 4.1.2
4
4
  Summary: Library for working with the BigFix REST API
5
5
  Home-page: https://github.com/jgstew/besapi
6
6
  Author: Matt Hansen, James Stewart
@@ -312,6 +312,58 @@ def test_bes_conn_json():
312
312
  assert result is not None
313
313
  assert "TestString" in result
314
314
  assert "BES Support" in result
315
+ print("testing session relevance with + in relevance")
316
+ str_relevance_plus = 'lengths of first matches (regex " +") of " "'
317
+ result = bes_conn.session_relevance_xml(str_relevance_plus)
318
+ print(result)
319
+ assert result is not None
320
+ else:
321
+ pytest.skip("Skipping BESConnection test, no config file or login failed.")
322
+
323
+
324
+ def test_bes_conn_session_relevance_with_plus():
325
+ """Test the BESConnection class with JSON output."""
326
+
327
+ bes_conn = besapi.plugin_utilities.get_besapi_connection(None)
328
+
329
+ if bes_conn and bes_conn.login():
330
+ print("testing session relevance with + in relevance")
331
+ str_relevance_plus = 'lengths of first matches (regex " +") of " "'
332
+ str_relevance_answer = "8"
333
+ result = bes_conn.session_relevance_xml(str_relevance_plus)
334
+ print(result)
335
+ assert result is not None
336
+ print(result.request.request.body)
337
+ assert f'<Answer type="integer">{str_relevance_answer}</Answer>' in str(result)
338
+ result = bes_conn.session_relevance_json_string(str_relevance_plus)
339
+ print(result)
340
+ assert result is not None
341
+ assert str_relevance_answer in str(result)
342
+ result = bes_conn.session_relevance_json(str_relevance_plus)
343
+ print(result)
344
+ assert result is not None
345
+ assert f"[{str_relevance_answer}]" in str(result["result"])
346
+ result = bes_conn.session_relevance_string(str_relevance_plus)
347
+ print(result)
348
+ assert result is not None
349
+ assert str_relevance_answer in str(result)
350
+ result = bes_conn.session_relevance_array(str_relevance_plus)
351
+ print(result)
352
+ assert result is not None
353
+ assert f"['{str_relevance_answer}']" in str(result)
354
+ result = bes_conn.session_relevance_json_array(str_relevance_plus)
355
+ print(result)
356
+ assert result is not None
357
+ assert f"[{str_relevance_answer}]" in str(result)
358
+
359
+ # test already escaped +
360
+ str_relevance_plus = r'lengths of first matches (regex " %2b") of " "'
361
+ print(str_relevance_plus)
362
+ result = bes_conn.session_relevance_xml(str_relevance_plus)
363
+ print(result)
364
+ assert result is not None
365
+ print(result.request.request.body)
366
+ assert f'<Answer type="integer">{str_relevance_answer}</Answer>' in str(result)
315
367
  else:
316
368
  pytest.skip("Skipping BESConnection test, no config file or login failed.")
317
369
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes