roksta 0.2.7__cp311-cp311-win_amd64.whl → 0.3.1__cp311-cp311-win_amd64.whl
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.
Potentially problematic release.
This version of roksta might be problematic. Click here for more details.
- roksta/__init__.cp311-win_amd64.pyd +0 -0
- roksta/ai/__init__.cp311-win_amd64.pyd +0 -0
- roksta/ai/call_ai.cp311-win_amd64.pyd +0 -0
- roksta/ai/gemini.cp311-win_amd64.pyd +0 -0
- roksta/ai/generic.cp311-win_amd64.pyd +0 -0
- roksta/ai/llm.cp311-win_amd64.pyd +0 -0
- roksta/ai/openai.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/__init__.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/delete_file.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/edit_file.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/final_response.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/get_file_summaries.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/read_file.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/regex_replace.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/shell_any.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/shell_limited.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/tool_defs.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/tool_utils.cp311-win_amd64.pyd +0 -0
- roksta/ai/tools/write_file.cp311-win_amd64.pyd +0 -0
- roksta/analytics.cp311-win_amd64.pyd +0 -0
- roksta/balance.cp311-win_amd64.pyd +0 -0
- roksta/build_project.cp311-win_amd64.pyd +0 -0
- roksta/chat_workflow.cp311-win_amd64.pyd +0 -0
- roksta/check_for_updates.cp311-win_amd64.pyd +0 -0
- roksta/checkpoints.cp311-win_amd64.pyd +0 -0
- roksta/clarify_goal.cp311-win_amd64.pyd +0 -0
- roksta/codebase_listing.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/__init__.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_activate_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_add_funds_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_auto_charge_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_auto_commit_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_building_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_chat_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_dev_rate_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_feedback_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_goal_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_help_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_init_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_linting_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_login_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_logout_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_payment_details_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_quit_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_redeem_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_request_activation_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_testing_command.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers/handle_usage_command.cp311-win_amd64.pyd +0 -0
- roksta/create_default_config.cp311-win_amd64.pyd +0 -0
- roksta/default_config.cp311-win_amd64.pyd +0 -0
- roksta/enums.cp311-win_amd64.pyd +0 -0
- roksta/env.cp311-win_amd64.pyd +0 -0
- roksta/extended_text_area.cp311-win_amd64.pyd +0 -0
- roksta/firebase.cp311-win_amd64.pyd +0 -0
- roksta/firebase_auth_web.cp311-win_amd64.pyd +0 -0
- roksta/firebase_config.cp311-win_amd64.pyd +0 -0
- roksta/fix_tests.cp311-win_amd64.pyd +0 -0
- roksta/gen_codebase_summaries.cp311-win_amd64.pyd +0 -0
- roksta/gen_one_line_goal.cp311-win_amd64.pyd +0 -0
- roksta/get_codebase_structure.cp311-win_amd64.pyd +0 -0
- roksta/get_failing_tests.cp311-win_amd64.pyd +0 -0
- roksta/goal_workflow.cp311-win_amd64.pyd +0 -0
- roksta/init_codebase.cp311-win_amd64.pyd +0 -0
- roksta/lint_code.cp311-win_amd64.pyd +0 -0
- roksta/logger.cp311-win_amd64.pyd +0 -0
- roksta/main.cp311-win_amd64.pyd +0 -0
- roksta/make_issue.cp311-win_amd64.pyd +0 -0
- roksta/new_features.cp311-win_amd64.pyd +0 -0
- roksta/parse_readme.cp311-win_amd64.pyd +0 -0
- roksta/propose_solution.cp311-win_amd64.pyd +0 -0
- roksta/response_formats.cp311-win_amd64.pyd +0 -0
- roksta/rewrite_goal.cp311-win_amd64.pyd +0 -0
- roksta/roksta.cp311-win_amd64.pyd +0 -0
- roksta/run_cli_goal.cp311-win_amd64.pyd +0 -0
- roksta/select_files.cp311-win_amd64.pyd +0 -0
- roksta/tips.cp311-win_amd64.pyd +0 -0
- roksta/utils.cp311-win_amd64.pyd +0 -0
- roksta/write_code.cp311-win_amd64.pyd +0 -0
- {roksta-0.2.7.dist-info → roksta-0.3.1.dist-info}/METADATA +2 -1
- roksta-0.3.1.dist-info/RECORD +109 -0
- tests/conftest.py +42 -0
- tests/functions/{api_v0_01 → api_v1_01}/__init__.py +1 -1
- tests/functions/{api_v0_01 → api_v1_01}/test__analytics.py +2 -3
- tests/functions/{api_v0_01 → api_v1_01}/test__gemini_proxy.py +51 -6
- tests/functions/{api_v0_01 → api_v1_01}/test__generic_proxy.py +31 -2
- tests/functions/{api_v0_01 → api_v1_01}/test__get_payment_details.py +2 -2
- tests/functions/{api_v0_01 → api_v1_01}/test__openai_proxy.py +50 -14
- tests/functions/{api_v0_01 → api_v1_01}/test__redeem_credit_code.py +2 -2
- tests/functions/{api_v0_01 → api_v1_01}/test__sync_emails.py +3 -2
- tests/functions/{api_v0_01 → api_v1_01}/test__take_payment.py +2 -2
- tests/functions/{api_v0_01 → api_v1_01}/test__use_activation_code.py +3 -2
- tests/functions/test_utils.py +484 -0
- roksta/ai/tools.cp311-win_amd64.pyd +0 -0
- roksta/command_handlers.cp311-win_amd64.pyd +0 -0
- roksta-0.2.7.dist-info/RECORD +0 -78
- tests/functions/test_utils_functions.py +0 -222
- {roksta-0.2.7.dist-info → roksta-0.3.1.dist-info}/WHEEL +0 -0
- {roksta-0.2.7.dist-info → roksta-0.3.1.dist-info}/entry_points.txt +0 -0
- {roksta-0.2.7.dist-info → roksta-0.3.1.dist-info}/top_level.txt +0 -0
- /tests/functions/{test_main_functions.py → test_main.py} +0 -0
roksta-0.2.7.dist-info/RECORD
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
roksta/__init__.cp311-win_amd64.pyd,sha256=kVtuv-PimTcT9vr5kce0a4sQHSyWzVVIk42ONQ9N5v4,15872
|
|
2
|
-
roksta/analytics.cp311-win_amd64.pyd,sha256=2XHICx3rn9iES7mTqAJyXZhzi7pLU8f-L9l8CL5CTXY,94208
|
|
3
|
-
roksta/balance.cp311-win_amd64.pyd,sha256=Z2UcWIfBHDFtxjkYpDjFGJv7GvlgH_mktRytzHcSzBU,117760
|
|
4
|
-
roksta/build_project.cp311-win_amd64.pyd,sha256=z7NYvpSpH2QF4wrdLNfKAzjEcY7Kqbhn70-4FcwZIBo,59904
|
|
5
|
-
roksta/chat_workflow.cp311-win_amd64.pyd,sha256=X19X2pWTyiCFfcL6NpPf4lpVlrqWxAceLMf8xbuIXrc,89088
|
|
6
|
-
roksta/check_for_updates.cp311-win_amd64.pyd,sha256=2axLsEHwPJYjJQgpuMrRfxLUsIYlfuOtxKFxoBq2jIQ,98304
|
|
7
|
-
roksta/checkpoints.cp311-win_amd64.pyd,sha256=6koOtWXwyrb5G3oJEgIBNWOoLfeRgi0UjgmtRChcDwU,81408
|
|
8
|
-
roksta/clarify_goal.cp311-win_amd64.pyd,sha256=cUqeOGWnxrspubfzdKmoMOrFBVqxlJq-NO23w__CxLI,64000
|
|
9
|
-
roksta/codebase_listing.cp311-win_amd64.pyd,sha256=ynCpvL-zd4O2fw3qyKAB8iu9uKlMWk30dz9YYz06jGI,46592
|
|
10
|
-
roksta/command_handlers.cp311-win_amd64.pyd,sha256=kKPBP_5eDEPA2jBpItGUs1qFGaS8VfOtO-_wEpxIAKM,371712
|
|
11
|
-
roksta/create_default_config.cp311-win_amd64.pyd,sha256=v-SMG_c2f_g12fQ9ZZgVn8a__W5LC3v4vc2MRdMsGGg,31744
|
|
12
|
-
roksta/default_config.cp311-win_amd64.pyd,sha256=Bg0FTTNQt6sAngtqstC3U_rLDZ7W2s68bQZcUA7nFO4,30720
|
|
13
|
-
roksta/enums.cp311-win_amd64.pyd,sha256=dCSJFLTD84hz3IJe7YQSW-yrg1K1V5kHdbs9WeoVO8o,135168
|
|
14
|
-
roksta/env.cp311-win_amd64.pyd,sha256=HPJCHScUJCyQOrH-QyuRVziU6NG9wT4ShgUmqu3v4d8,27136
|
|
15
|
-
roksta/extended_text_area.cp311-win_amd64.pyd,sha256=lAmxRNGVF9h3y-mG1F4a9QjadUmjbipvfMb7McpIL54,107520
|
|
16
|
-
roksta/firebase.cp311-win_amd64.pyd,sha256=078BGjj0iHa95XELZWytI4BOLIl9m6ittzltlwW_5VQ,167936
|
|
17
|
-
roksta/firebase_auth_web.cp311-win_amd64.pyd,sha256=CIhBCcxx36uyxlNdrPEcHRQWsZ3yhJ23XDvq-_82LTc,170496
|
|
18
|
-
roksta/firebase_config.cp311-win_amd64.pyd,sha256=hHOvz3BmakHGBliexJNzBw-byuwM38IUhO4u3lEIkOY,21504
|
|
19
|
-
roksta/fix_tests.cp311-win_amd64.pyd,sha256=CAC80fQe_6_YuKfzzhKvotq2q9P9EFFzxJpsRz2FD2c,73728
|
|
20
|
-
roksta/gen_codebase_summaries.cp311-win_amd64.pyd,sha256=XzQrevEOTTFk_HJAwqMiZjSKDvRnIU89-1d2wGUhmP8,230400
|
|
21
|
-
roksta/gen_one_line_goal.cp311-win_amd64.pyd,sha256=9CocGZ0tTtWb6l55qxzhMHQ5gDjr7eNA6EbyChFrNVs,63488
|
|
22
|
-
roksta/get_codebase_structure.cp311-win_amd64.pyd,sha256=SLvOIr4SOr2-KZYIC5xg9Fsrt6rRo8sstVMw6T4qXFI,66048
|
|
23
|
-
roksta/get_failing_tests.cp311-win_amd64.pyd,sha256=aGW-VctMCU1bX1k5kYdYaIfzgudROegtt0Dd7zouKxI,69120
|
|
24
|
-
roksta/goal_workflow.cp311-win_amd64.pyd,sha256=dhj1Ls513lO0m9NrITl_fxLw18gDHrfjEOE38_wE0o8,189952
|
|
25
|
-
roksta/init_codebase.cp311-win_amd64.pyd,sha256=Oi5zfTn5Acde8_QIfTbbJSq9Z6VBV0WOP5VDvNzcXh4,95744
|
|
26
|
-
roksta/lint_code.cp311-win_amd64.pyd,sha256=ry6JtopCzFif6ocjAlJs-7wtILoHPuHyMDBfmzKRLh8,69632
|
|
27
|
-
roksta/logger.cp311-win_amd64.pyd,sha256=gpKI2DjQpSnFg1EkeZ36fBLS2BtU4WmosYQQ0YrR1RA,38400
|
|
28
|
-
roksta/main.cp311-win_amd64.pyd,sha256=d_q43_dTcAzGLXlU8Bj-MLMlLnLBe1Dc-bBqfG66dQU,38912
|
|
29
|
-
roksta/make_issue.cp311-win_amd64.pyd,sha256=5jUZHdcw0NGTPCL0O58VkKHO0qBpvivKXkT9k-xUwto,69632
|
|
30
|
-
roksta/new_features.cp311-win_amd64.pyd,sha256=nWGmfU_RbX6bkb2rURiLP0ytLhIlsC0bv4Kh8uYtTpc,16384
|
|
31
|
-
roksta/parse_readme.cp311-win_amd64.pyd,sha256=qOO2SK9Zg_l88Gy5jU4WBY-ndUp_BobIhybRKZo9O1E,61952
|
|
32
|
-
roksta/propose_solution.cp311-win_amd64.pyd,sha256=hMni5zUGAoWgbW5AEsnXPcZ7ZY4_f4wFXewisXLU98k,61440
|
|
33
|
-
roksta/response_formats.cp311-win_amd64.pyd,sha256=hQivV6gt6s6X2lo-uzyjojEzBzD0Z3IAzeQfuP1LZYQ,41984
|
|
34
|
-
roksta/rewrite_goal.cp311-win_amd64.pyd,sha256=EVGA8xj3NhBE6QaPAwZ77keaiblDxhtzJGj1Jy53L2M,55808
|
|
35
|
-
roksta/roksta.cp311-win_amd64.pyd,sha256=hRwYVSkwrKElbkFG7yy-DbrbH_xwJQ1hOaQlWQy7DOI,229376
|
|
36
|
-
roksta/run_cli_goal.cp311-win_amd64.pyd,sha256=8HFka6AWgw-7s16UKKDNrOmIyv71QesEzY5cZcb5ui0,69120
|
|
37
|
-
roksta/select_files.cp311-win_amd64.pyd,sha256=C6iY011nQT9ix_itXnBFqB2fdvkKEjXWr97mTfI5qfM,66048
|
|
38
|
-
roksta/tips.cp311-win_amd64.pyd,sha256=r9aphvYXXqwyfAFlbAzRvamjOOW5jEfrFcx2gGCjP1U,20992
|
|
39
|
-
roksta/utils.cp311-win_amd64.pyd,sha256=xQHjBcggSNyuxboxhcadqUH3hNGt52zFWGRDX6kLExM,221184
|
|
40
|
-
roksta/write_code.cp311-win_amd64.pyd,sha256=8WWdjkVhGyIL4jyKMvsNvvR8z7-ZJPr5EhiCCisdMDQ,58880
|
|
41
|
-
roksta/ai/__init__.cp311-win_amd64.pyd,sha256=2Bfwj4T5oOMgbXo-SE4fkp2t8qXvrUtcjihnZgIImQE,15872
|
|
42
|
-
roksta/ai/call_ai.cp311-win_amd64.pyd,sha256=yl4gtbx9Qjm8KusVdO1786UKK1xcRlyyHf3KEz75Ha0,72192
|
|
43
|
-
roksta/ai/gemini.cp311-win_amd64.pyd,sha256=gB25h3r7Akjg5kahw5MHLy0JQGdz07JTEVnSr_8AEJw,143872
|
|
44
|
-
roksta/ai/generic.cp311-win_amd64.pyd,sha256=DvL70EWE2alGSCxSzlnuEjFqsi8tVv_ZsLH0k4R4WZg,105984
|
|
45
|
-
roksta/ai/llm.cp311-win_amd64.pyd,sha256=-LFfN8JbjDz5HtSF0z_eLi67k34rBft0Ljt9YEFBmjI,92160
|
|
46
|
-
roksta/ai/openai.cp311-win_amd64.pyd,sha256=MpnTcmY51RZpNaEwtUuroJIreZprW9g_wlYpxl0ZrBk,103424
|
|
47
|
-
roksta/ai/tools.cp311-win_amd64.pyd,sha256=vRxuWnZkiZMEYYzcSUpQOdcdwqi-tX4dNAQaBZX5x2E,231936
|
|
48
|
-
tests/__init__.py,sha256=meQjVtD2zimtDw3tIP6nNWHGDQVC42as-c_y038cYnk,126
|
|
49
|
-
tests/conftest.py,sha256=auOTmcnUGIgvlQsVEOhchjLgUtQmnzMtCc5N3Sr79Cw,6464
|
|
50
|
-
tests/functions/__init__.py,sha256=msAiuVOA8jfqVxichPYYyfBFCVEFB_xRvj4lrSpKK1w,97
|
|
51
|
-
tests/functions/test_auth.py,sha256=SNzmpkoxknrxx6cTE91MM2kN3F08GB1pRuupP5IrQs0,1016
|
|
52
|
-
tests/functions/test_main_functions.py,sha256=LgWLAOtSfDXNfHhAAr-j9Peb5JBLFtQ0eKAWqTxLNDU,2648
|
|
53
|
-
tests/functions/test_utils_functions.py,sha256=2x4W2JGnnKabTSTNKQ_DdcZl7K9HVF0N4kudTL05b3Y,7590
|
|
54
|
-
tests/functions/api_v0_01/__init__.py,sha256=6EY0sGI3Jkmk4BGjNzSgyLGxFIGy06vwD76KDKAHh4g,126
|
|
55
|
-
tests/functions/api_v0_01/test__analytics.py,sha256=d0zfl_ydtFc8cxlaL5GV76Rz2P7XsHoqEp2rYdN1zk0,16224
|
|
56
|
-
tests/functions/api_v0_01/test__gemini_proxy.py,sha256=BuT2IWS0NHCa1FzEN8YPf6t00TOjWbpF-SYSOZMWPCg,11459
|
|
57
|
-
tests/functions/api_v0_01/test__generic_proxy.py,sha256=2CSQ8OYUM0Ertq9PYueWDBWgPmz5bpRO8YICAwA_ZUc,16589
|
|
58
|
-
tests/functions/api_v0_01/test__get_payment_details.py,sha256=wvhH5xliVIkU6GvvWFKF-lAV8mSZfj0HCT284BjDYCw,14091
|
|
59
|
-
tests/functions/api_v0_01/test__openai_proxy.py,sha256=tXAz-Ukl3FD1Zdv083xczoQzG-dOS53uL2gBjB-Wcx8,16174
|
|
60
|
-
tests/functions/api_v0_01/test__redeem_credit_code.py,sha256=xDzTWQxcIztksCWpTNibNgZ2ZPT2gqgdtljZiE8wMlU,6514
|
|
61
|
-
tests/functions/api_v0_01/test__sync_emails.py,sha256=5nH4wxcqHqowc4C-pNShF4eWS52Pw6hZxsaOTn7f66I,13022
|
|
62
|
-
tests/functions/api_v0_01/test__take_payment.py,sha256=NFoIw4RVMT63c7diZ7gt6N03dp26vVlognZBchpWRLY,18513
|
|
63
|
-
tests/functions/api_v0_01/test__use_activation_code.py,sha256=3XS-N-fL7UIOev2kzphlDy-2ukykQLzb_0kmlkCr1gQ,17396
|
|
64
|
-
tests/functions/api_v1_00/__init__.py,sha256=VdV5Oy6FRVT4S1xK34YodylJ7FY6jqvjujkS2Qvbyt0,126
|
|
65
|
-
tests/functions/api_v1_00/test__analytics.py,sha256=s_pK4ySr86PC4ZBr7Y7bCHOEuFj36amaWrianBZ_QbU,16222
|
|
66
|
-
tests/functions/api_v1_00/test__gemini_proxy.py,sha256=ZNYBQ9agPyNYGAVYlWPY6IF8wP_5IQ4nbHOpY8TnKEw,13696
|
|
67
|
-
tests/functions/api_v1_00/test__generic_proxy.py,sha256=f2KjO8v_mh4nBwdkFXJLYfFUBpJS_RDtQNfn0ltE2oM,18101
|
|
68
|
-
tests/functions/api_v1_00/test__get_payment_details.py,sha256=GRMAn8WR-07EBZ0IkeVE4MARFUbDdDhEHO2dITRxnVA,14091
|
|
69
|
-
tests/functions/api_v1_00/test__openai_proxy.py,sha256=i1f7S8IFgWiG6WGG-YYptjTCOjSudujEMyhP16BVlW0,18175
|
|
70
|
-
tests/functions/api_v1_00/test__redeem_credit_code.py,sha256=A5WwuSXBX5TiZPdYrDRkUmpppBXG00lcP0LmRz0gNr0,6514
|
|
71
|
-
tests/functions/api_v1_00/test__sync_emails.py,sha256=e0rb637Ois25t__1G8Yp7Pj8WgC-R1I9SUgS6bK1dsU,13024
|
|
72
|
-
tests/functions/api_v1_00/test__take_payment.py,sha256=RQBUHcgN3-XOoPtAjca_72q4BaZxr_L3G_Nss5-gb2g,18513
|
|
73
|
-
tests/functions/api_v1_00/test__use_activation_code.py,sha256=ZOCwXHzenH0l1WhmZP8s8vaXIk58lHpKJ0igx0VEDwY,17398
|
|
74
|
-
roksta-0.2.7.dist-info/METADATA,sha256=tqdrCdR2ZSh1KSc_8dkuQ8tXOVkASKraZpUqAQgptjU,1466
|
|
75
|
-
roksta-0.2.7.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
|
|
76
|
-
roksta-0.2.7.dist-info/entry_points.txt,sha256=mzRdYg_DlzZRwjxYUt9-gyoRCkM1QBTeTbwETgiTdGw,44
|
|
77
|
-
roksta-0.2.7.dist-info/top_level.txt,sha256=lvciNZQ1dPGXpiCLdWVXK03n9fKHjbQdwjqQbnUjeYM,13
|
|
78
|
-
roksta-0.2.7.dist-info/RECORD,,
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import importlib
|
|
2
|
-
import sys
|
|
3
|
-
import types
|
|
4
|
-
import json
|
|
5
|
-
import pytest
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def _setup_basic_stubs(secret_data=b'MY_SECRET', secret_side_effect=None, auth_verify=lambda token: {'uid': 'u1'}):
|
|
9
|
-
"""Install minimal stub modules for google.cloud.secretmanager, firebase_functions and firebase_admin.
|
|
10
|
-
Returns a dict of original sys.modules entries for cleanup.
|
|
11
|
-
"""
|
|
12
|
-
orig = {}
|
|
13
|
-
names = [
|
|
14
|
-
'google',
|
|
15
|
-
'google.cloud',
|
|
16
|
-
'google.cloud.secretmanager',
|
|
17
|
-
'firebase_functions',
|
|
18
|
-
'firebase_admin',
|
|
19
|
-
'firebase_admin.auth',
|
|
20
|
-
]
|
|
21
|
-
for name in names:
|
|
22
|
-
orig[name] = sys.modules.get(name)
|
|
23
|
-
|
|
24
|
-
# google package and submodules
|
|
25
|
-
google_mod = types.ModuleType('google')
|
|
26
|
-
cloud_mod = types.ModuleType('google.cloud')
|
|
27
|
-
secretmanager_mod = types.ModuleType('google.cloud.secretmanager')
|
|
28
|
-
|
|
29
|
-
class _Payload:
|
|
30
|
-
def __init__(self, data):
|
|
31
|
-
self.data = data
|
|
32
|
-
|
|
33
|
-
class _Response:
|
|
34
|
-
def __init__(self, data):
|
|
35
|
-
self.payload = _Payload(data)
|
|
36
|
-
|
|
37
|
-
class SecretManagerServiceClient:
|
|
38
|
-
def access_secret_version(self, request=None):
|
|
39
|
-
if secret_side_effect:
|
|
40
|
-
# raise the provided exception instance for testing
|
|
41
|
-
raise secret_side_effect
|
|
42
|
-
return _Response(secret_data)
|
|
43
|
-
|
|
44
|
-
secretmanager_mod.SecretManagerServiceClient = SecretManagerServiceClient
|
|
45
|
-
cloud_mod.secretmanager = secretmanager_mod
|
|
46
|
-
google_mod.cloud = cloud_mod
|
|
47
|
-
|
|
48
|
-
sys.modules['google'] = google_mod
|
|
49
|
-
sys.modules['google.cloud'] = cloud_mod
|
|
50
|
-
sys.modules['google.cloud.secretmanager'] = secretmanager_mod
|
|
51
|
-
|
|
52
|
-
# firebase_functions stub with a Response type expected by utils.create_json_response
|
|
53
|
-
firebase_functions_mod = types.ModuleType('firebase_functions')
|
|
54
|
-
|
|
55
|
-
class FakeResponse:
|
|
56
|
-
def __init__(self, response=None, mimetype=None, status=200, **kwargs):
|
|
57
|
-
self.status_code = status
|
|
58
|
-
if isinstance(response, (dict, list)):
|
|
59
|
-
self._body_text = json.dumps(response)
|
|
60
|
-
else:
|
|
61
|
-
self._body_text = '' if response is None else response
|
|
62
|
-
self.headers = kwargs.get('headers', {})
|
|
63
|
-
|
|
64
|
-
def get_data(self, as_text=False):
|
|
65
|
-
if as_text:
|
|
66
|
-
return self._body_text
|
|
67
|
-
return self._body_text.encode('utf-8')
|
|
68
|
-
|
|
69
|
-
firebase_functions_mod.https_fn = types.SimpleNamespace(Request=object, Response=FakeResponse)
|
|
70
|
-
sys.modules['firebase_functions'] = firebase_functions_mod
|
|
71
|
-
|
|
72
|
-
# firebase_admin + auth stub
|
|
73
|
-
firebase_admin_mod = types.ModuleType('firebase_admin')
|
|
74
|
-
auth_mod = types.ModuleType('firebase_admin.auth')
|
|
75
|
-
|
|
76
|
-
def _verify_id_token(token):
|
|
77
|
-
return auth_verify(token)
|
|
78
|
-
|
|
79
|
-
auth_mod.verify_id_token = _verify_id_token
|
|
80
|
-
firebase_admin_mod.auth = auth_mod
|
|
81
|
-
sys.modules['firebase_admin'] = firebase_admin_mod
|
|
82
|
-
sys.modules['firebase_admin.auth'] = auth_mod
|
|
83
|
-
|
|
84
|
-
return orig
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def _restore_orig(orig):
|
|
88
|
-
for name, val in orig.items():
|
|
89
|
-
if val is None:
|
|
90
|
-
if name in sys.modules:
|
|
91
|
-
del sys.modules[name]
|
|
92
|
-
else:
|
|
93
|
-
sys.modules[name] = val
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
def test_get_secret_key_returns_decoded_string_on_success():
|
|
97
|
-
orig = _setup_basic_stubs(secret_data=b'MY_SECRET')
|
|
98
|
-
try:
|
|
99
|
-
if 'utils' in sys.modules:
|
|
100
|
-
del sys.modules['utils']
|
|
101
|
-
utils = importlib.import_module('utils')
|
|
102
|
-
res = utils.get_secret_key('any')
|
|
103
|
-
assert res == 'MY_SECRET'
|
|
104
|
-
finally:
|
|
105
|
-
_restore_orig(orig)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def test_get_secret_key_raises_exception_on_client_error():
|
|
109
|
-
orig = _setup_basic_stubs(secret_side_effect=Exception('boom'))
|
|
110
|
-
try:
|
|
111
|
-
if 'utils' in sys.modules:
|
|
112
|
-
del sys.modules['utils']
|
|
113
|
-
utils = importlib.import_module('utils')
|
|
114
|
-
with pytest.raises(Exception) as exc:
|
|
115
|
-
utils.get_secret_key('any')
|
|
116
|
-
assert 'Failed to retrieve secret key' in str(exc.value)
|
|
117
|
-
assert 'boom' in str(exc.value)
|
|
118
|
-
finally:
|
|
119
|
-
_restore_orig(orig)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
def test_verify_firebase_token_raises_when_header_missing_or_invalid():
|
|
123
|
-
orig = _setup_basic_stubs()
|
|
124
|
-
try:
|
|
125
|
-
if 'utils' in sys.modules:
|
|
126
|
-
del sys.modules['utils']
|
|
127
|
-
utils = importlib.import_module('utils')
|
|
128
|
-
|
|
129
|
-
class DummyRequest:
|
|
130
|
-
def __init__(self, headers=None):
|
|
131
|
-
self.headers = headers or {}
|
|
132
|
-
|
|
133
|
-
# Missing header
|
|
134
|
-
req = DummyRequest(headers={})
|
|
135
|
-
with pytest.raises(Exception) as exc:
|
|
136
|
-
utils.verify_firebase_token(req)
|
|
137
|
-
assert 'Missing or invalid Authorization header' in str(exc.value)
|
|
138
|
-
|
|
139
|
-
# Header present but not starting with 'Bearer '
|
|
140
|
-
req2 = DummyRequest(headers={'Authorization': 'Token abc'})
|
|
141
|
-
with pytest.raises(Exception) as exc2:
|
|
142
|
-
utils.verify_firebase_token(req2)
|
|
143
|
-
assert 'Missing or invalid Authorization header' in str(exc2.value)
|
|
144
|
-
finally:
|
|
145
|
-
_restore_orig(orig)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
def test_verify_firebase_token_calls_auth_verify_and_returns_payload():
|
|
149
|
-
orig = _setup_basic_stubs(auth_verify=lambda token: {'uid': 'user_1'})
|
|
150
|
-
try:
|
|
151
|
-
if 'utils' in sys.modules:
|
|
152
|
-
del sys.modules['utils']
|
|
153
|
-
utils = importlib.import_module('utils')
|
|
154
|
-
|
|
155
|
-
class DummyRequest:
|
|
156
|
-
def __init__(self, headers=None):
|
|
157
|
-
self.headers = headers or {}
|
|
158
|
-
|
|
159
|
-
req = DummyRequest(headers={'Authorization': 'Bearer TOK'})
|
|
160
|
-
res = utils.verify_firebase_token(req)
|
|
161
|
-
assert res == {'uid': 'user_1'}
|
|
162
|
-
finally:
|
|
163
|
-
_restore_orig(orig)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
def test_verify_firebase_token_wraps_auth_exceptions():
|
|
167
|
-
def _raiser(token):
|
|
168
|
-
raise Exception('bad token')
|
|
169
|
-
|
|
170
|
-
orig = _setup_basic_stubs(auth_verify=_raiser)
|
|
171
|
-
try:
|
|
172
|
-
if 'utils' in sys.modules:
|
|
173
|
-
del sys.modules['utils']
|
|
174
|
-
utils = importlib.import_module('utils')
|
|
175
|
-
|
|
176
|
-
class DummyRequest:
|
|
177
|
-
def __init__(self, headers=None):
|
|
178
|
-
self.headers = headers or {}
|
|
179
|
-
|
|
180
|
-
req = DummyRequest(headers={'Authorization': 'Bearer TOK'})
|
|
181
|
-
with pytest.raises(Exception) as exc:
|
|
182
|
-
utils.verify_firebase_token(req)
|
|
183
|
-
assert 'Authentication failed' in str(exc.value)
|
|
184
|
-
assert 'bad token' in str(exc.value)
|
|
185
|
-
finally:
|
|
186
|
-
_restore_orig(orig)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def test_get_api_key_uses_lowercase_family_name_and_get_secret_key(monkeypatch):
|
|
190
|
-
orig = _setup_basic_stubs()
|
|
191
|
-
try:
|
|
192
|
-
if 'utils' in sys.modules:
|
|
193
|
-
del sys.modules['utils']
|
|
194
|
-
utils = importlib.import_module('utils')
|
|
195
|
-
|
|
196
|
-
called = {}
|
|
197
|
-
|
|
198
|
-
def fake_get_secret_key(name):
|
|
199
|
-
called['name'] = name
|
|
200
|
-
return 'THE_KEY'
|
|
201
|
-
|
|
202
|
-
monkeypatch.setattr(utils, 'get_secret_key', fake_get_secret_key)
|
|
203
|
-
from enums import LlmFamily
|
|
204
|
-
res = utils.get_api_key(LlmFamily.OPENAI)
|
|
205
|
-
assert res == 'THE_KEY'
|
|
206
|
-
assert called['name'] == 'openai-api-key'
|
|
207
|
-
finally:
|
|
208
|
-
_restore_orig(orig)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def test_create_json_response_returns_formatted_response():
|
|
212
|
-
orig = _setup_basic_stubs()
|
|
213
|
-
try:
|
|
214
|
-
if 'utils' in sys.modules:
|
|
215
|
-
del sys.modules['utils']
|
|
216
|
-
utils = importlib.import_module('utils')
|
|
217
|
-
resp = utils.create_json_response(True, {'a': 1}, 201)
|
|
218
|
-
assert getattr(resp, 'status_code', None) == 201
|
|
219
|
-
data = json.loads(resp.get_data(as_text=True))
|
|
220
|
-
assert data == {"success": True, "payload": {"a": 1}}
|
|
221
|
-
finally:
|
|
222
|
-
_restore_orig(orig)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|