Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Test Suite Fixes #39

Open
surapuramakhil opened this issue Jan 22, 2025 · 2 comments · Fixed by #41
Open

[BUG]: Test Suite Fixes #39

surapuramakhil opened this issue Jan 22, 2025 · 2 comments · Fixed by #41
Assignees
Labels
bug Something isn't working stale

Comments

@surapuramakhil
Copy link
Collaborator

surapuramakhil commented Jan 22, 2025

Describe the bug

Test Suite is failing on main

Steps to reproduce

Report:

job-hunt-assistant-py3.13(base) akhilsurapuram@Akhils-MacBook-Pro Auto_Jobs_Applier_AI_Agent % poetry run pytest                                         
================================================================== test session starts ===================================================================
platform darwin -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
rootdir: /Users/akhilsurapuram/openSource/myContirubtions/clean_linkedIN/Auto_Jobs_Applier_AI_Agent
configfile: pytest.ini
testpaths: tests
plugins: cov-6.0.0, env-1.1.5, anyio-4.8.0, dotenv-0.5.2, mock-3.14.0
collected 45 items                                                                                                                                       

tests/integration/test_integration_tests.py .                                                                                                      [  2%]
tests/integration/test_web_search_engine_integration.py F                                                                                          [  4%]
tests/unit/test_aihawk_bot_facade.py .                                                                                                             [  6%]
tests/unit/test_job_application_profile.py ....                                                                                                    [ 15%]
tests/unit/test_linkedIn_authenticator.py ........                                                                                                 [ 33%]
tests/unit/test_regex_utils.py ...................                                                                                                 [ 75%]
tests/unit/test_utils.py .....                                                                                                                     [ 86%]
tests/unit/test_web_search_engine.py F..                                                                                                           [ 93%]
tests/unit/test_web_search_engine_factory.py ...                                                                                                   [100%]

======================================================================== FAILURES ========================================================================
_________________________________________________________ test_google_search_engine_integration __________________________________________________________
tests/integration/test_web_search_engine_integration.py:7: in test_google_search_engine_integration
    pagenated_response = search_engine.search("Python integration testing")
src/services/web_search_engine.py:224: in search
    response.raise_for_status()
../../../../Library/Caches/pypoetry/virtualenvs/job-hunt-assistant-Y6cxGshj-py3.13/lib/python3.13/site-packages/requests/models.py:1024: in raise_for_status
    raise HTTPError(http_error_msg, response=self)
E   requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.googleapis.com/customsearch/v1?key=XXXXXXXX&cx=XXXXXXX&q=Python+integration+testing&start=1&num=%3Cproperty+object+at+0x105997600%3E
_______________________________________________________________ test_google_search_engine ________________________________________________________________
../../../../.pyenv/versions/3.13.1/lib/python3.13/unittest/mock.py:977: in assert_called_with
    raise AssertionError(_error_message()) from cause
E   AssertionError: expected call not found.
E   Expected: get('https://www.googleapis.com/customsearch/v1', params={'key': 'mock_api_key', 'cx': 'mock_id', 'q': 'test query', 'start': 1, 'num': 10})
E     Actual: get('https://www.googleapis.com/customsearch/v1', params={'key': 'mock_api_key', 'cx': 'mock_id', 'q': 'test query', 'start': 1, 'num': <property object at 0x105997600>})

During handling of the above exception, another exception occurred:
../../../../.pyenv/versions/3.13.1/lib/python3.13/unittest/mock.py:989: in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
E   AssertionError: expected call not found.
E   Expected: get('https://www.googleapis.com/customsearch/v1', params={'key': 'mock_api_key', 'cx': 'mock_id', 'q': 'test query', 'start': 1, 'num': 10})
E     Actual: get('https://www.googleapis.com/customsearch/v1', params={'key': 'mock_api_key', 'cx': 'mock_id', 'q': 'test query', 'start': 1, 'num': <property object at 0x105997600>})
E   
E   pytest introspection follows:
E   
E   Kwargs:
E   assert {'params': {'... query', ...}} == {'params': {'... query', ...}}
E     
E     Differing items:
E     {'params': {'cx': 'mock_id', 'key': 'mock_api_key', 'num': <property object at 0x105997600>, 'q': 'test query', ...}} != {'params': {'cx': 'mock_id', 'key': 'mock_api_key', 'num': 10, 'q': 'test query', ...}}
E     Use -v to get more diff

During handling of the above exception, another exception occurred:
tests/unit/test_web_search_engine.py:24: in test_google_search_engine
    mock_get.assert_called_once_with(
E   AssertionError: expected call not found.
E   Expected: get('https://www.googleapis.com/customsearch/v1', params={'key': 'mock_api_key', 'cx': 'mock_id', 'q': 'test query', 'start': 1, 'num': 10})
E     Actual: get('https://www.googleapis.com/customsearch/v1', params={'key': 'mock_api_key', 'cx': 'mock_id', 'q': 'test query', 'start': 1, 'num': <property object at 0x105997600>})
E   
E   pytest introspection follows:
E   
E   Kwargs:
E   assert {'params': {'... query', ...}} == {'params': {'... query', ...}}
E     
E     Differing items:
E     {'params': {'cx': 'mock_id', 'key': 'mock_api_key', 'num': <property object at 0x105997600>, 'q': 'test query', ...}} != {'params': {'cx': 'mock_id', 'key': 'mock_api_key', 'num': 10, 'q': 'test query', ...}}
E     Use -v to get more diff
==================================================================== warnings summary ====================================================================
../../../../Library/Caches/pypoetry/virtualenvs/job-hunt-assistant-Y6cxGshj-py3.13/lib/python3.13/site-packages/reportlab/lib/rl_safe_eval.py:12
  /Users/akhilsurapuram/Library/Caches/pypoetry/virtualenvs/job-hunt-assistant-Y6cxGshj-py3.13/lib/python3.13/site-packages/reportlab/lib/rl_safe_eval.py:12: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
    haveNameConstant = hasattr(ast,'NameConstant')

../../../../Library/Caches/pypoetry/virtualenvs/job-hunt-assistant-Y6cxGshj-py3.13/lib/python3.13/site-packages/pydantic/v1/typing.py:68: 16 warnings
  /Users/akhilsurapuram/Library/Caches/pypoetry/virtualenvs/job-hunt-assistant-Y6cxGshj-py3.13/lib/python3.13/site-packages/pydantic/v1/typing.py:68: DeprecationWarning: Failing to pass a value to the 'type_params' parameter of 'typing.ForwardRef._evaluate' is deprecated, as it leads to incorrect behaviour when calling typing.ForwardRef._evaluate on a stringified annotation that references a PEP 695 type parameter. It will be disallowed in Python 3.15.
    return cast(Any, type_)._evaluate(globalns, localns, recursive_guard=set())

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform darwin, python 3.13.1-final-0 ----------
Name                                           Stmts   Miss  Cover   Missing
----------------------------------------------------------------------------
src/__init__.py                                    0      0   100%
src/ai_hawk/__init__.py                            0      0   100%
src/ai_hawk/authenticator.py                      61     31    49%   17, 21, 26, 33-40, 47-48, 53-82, 86
src/ai_hawk/bot_facade.py                         85     85     0%   1-100
src/ai_hawk/job_applier.py                       469    420    10%   47, 60-73, 76-97, 107-113, 116-166, 175-196, 199-221, 224-234, 241-271, 274-367, 372-490, 493-496, 501-531, 539-572, 578-628, 633-689, 692-729, 734-742, 745-750, 753
src/ai_hawk/job_manager.py                       311    255    18%   34-37, 41-43, 47-49, 61-83, 86-87, 90-91, 94-136, 139-244, 248-259, 262-352, 355-386, 400-403, 406-423, 426-445
src/ai_hawk/llm/llm_manager.py                   382    302    21%   85, 90-92, 97-99, 104-106, 109-111, 116-122, 125-126, 130-131, 134-135, 140-146, 165-166, 171-176, 179-183, 188, 191-211, 214, 219-220, 224-326, 331-332, 335-387, 390-460, 465-466, 470, 474-480, 484-486, 490-491, 494-495, 498-500, 505-506, 509, 512-521, 524-526, 529-610, 615-639, 642-649, 652-668, 671-686, 698-738
src/ai_hawk/llm/prompts.py                        21      0   100%
src/config.py                                     38     12    68%   42-57, 66
src/constants.py                                  74      0   100%
src/custom_exception.py                            8      4    50%   3-4, 8-9
src/job.py                                        43     11    74%   37-38, 41-42, 45-46, 52-66
src/jobContext.py                                  7      0   100%
src/job_application.py                            13      7    46%   6-9, 12, 15, 18
src/job_application_profile.py                   151     61    60%   71-76, 79-80, 90-98, 105-116, 124-125, 129-134, 141-152, 159-170
src/job_application_saver.py                      49     32    35%   19-20, 24-33, 38-47, 51-56, 60-71, 75-88
src/job_portals/__init__.py                        0      0   100%
src/job_portals/application_form_elements.py      19      0   100%
src/job_portals/base_job_portal.py               157     52    67%   19, 25-26, 33, 37, 44, 50, 54, 58, 62, 66, 70, 76, 80, 84, 88, 92, 96, 101, 106, 111, 115, 120, 124, 128, 132, 136, 140, 144, 148, 154, 158, 162, 166, 170, 174, 178, 182, 187, 193, 198, 203, 208, 213, 217-225, 234
src/job_portals/lever/__init__.py                  0      0   100%
src/job_portals/lever/application_page.py        166    166     0%   1-310
src/job_portals/lever/authenticator.py            16     16     0%   1-23
src/job_portals/lever/job_page.py                 41     41     0%   1-61
src/job_portals/lever/jobs_page.py                66     66     0%   1-155
src/job_portals/lever/lever.py                    25     25     0%   1-31
src/job_portals/linkedIn/authenticator.py         27      1    96%   14
src/logger.py                                     36      0   100%
src/main.py                                      172    172     0%   1-343
src/regex_utils.py                                 9      0   100%
src/services/__init__.py                           0      0   100%
src/services/web_search_engine.py                221     85    62%   71, 83, 93, 114-118, 122, 125-129, 132-136, 139-143, 146-149, 152-153, 159, 168, 180-196, 203, 247-248, 267-282, 289, 344-360, 367, 422-437, 447, 451, 461-466
src/utils/__init__.py                              0      0   100%
src/utils/browser_utils.py                       112     59    47%   23-24, 32-36, 57-58, 61-62, 70-72, 75-78, 89-92, 101-104, 111-112, 127-129, 133-134, 146-184, 189-205
src/utils/chrome_utils.py                         48      2    96%   57-58
src/utils/time_utils.py                            8      3    62%   5, 8, 12
----------------------------------------------------------------------------
TOTAL                                           2835   1908    33%

================================================================ short test summary info =================================================================
FAILED tests/integration/test_web_search_engine_integration.py::test_google_search_engine_integration - requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://www.googleapis.com/customsearch/v1?key=AIzaSyBUkC3H9AfZ6EE-ISl41QklxX3n...
FAILED tests/unit/test_web_search_engine.py::test_google_search_engine - AssertionError: expected call not found.
======================================================= 2 failed, 43 passed, 17 warnings in 1.34s ========================================================
job-hunt-assistant-py3.13(base) akhilsurapuram@Akhils-MacBook-Pro Auto_Jobs_Applier_AI_Agent % 

Expected behavior

No response

Actual behavior

No response

Branch

main

Branch name

No response

Python version

No response

LLM Used

No response

Model used

No response

Additional context

No response

@surapuramakhil surapuramakhil added the bug Something isn't working label Jan 22, 2025
@surapuramakhil surapuramakhil moved this from Backlog to In Progress in Job hunt Assistant Jan 22, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Job hunt Assistant Jan 30, 2025
@github-project-automation github-project-automation bot moved this from Done to Backlog in Job hunt Assistant Jan 30, 2025
@surapuramakhil
Copy link
Collaborator Author

testcase fix is not handled

Copy link

This issue has been marked as stale due to inactivity. Please comment or update if this is still relevant.

@github-actions github-actions bot added the stale label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

1 participant