roksta 0.3.1__cp311-cp311-macosx_10_9_universal2.whl → 0.3.2__cp311-cp311-macosx_10_9_universal2.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.
Files changed (37) hide show
  1. roksta/check_for_updates.cpython-311-darwin.so +0 -0
  2. roksta/clarify_goal.cpython-311-darwin.so +0 -0
  3. roksta/command_handlers/handle_auto_commit_command.cpython-311-darwin.so +0 -0
  4. roksta/command_handlers/handle_building_command.cpython-311-darwin.so +0 -0
  5. roksta/command_handlers/handle_dev_rate_command.cpython-311-darwin.so +0 -0
  6. roksta/command_handlers/handle_linting_command.cpython-311-darwin.so +0 -0
  7. roksta/command_handlers/handle_testing_command.cpython-311-darwin.so +0 -0
  8. roksta/create_default_config.cpython-311-darwin.so +0 -0
  9. roksta/env.cpython-311-darwin.so +0 -0
  10. roksta/fix_tests.cpython-311-darwin.so +0 -0
  11. roksta/goal_workflow.cpython-311-darwin.so +0 -0
  12. roksta/init_codebase.cpython-311-darwin.so +0 -0
  13. roksta/lint_code.cpython-311-darwin.so +0 -0
  14. roksta/new_features.cpython-311-darwin.so +0 -0
  15. roksta/propose_solution.cpython-311-darwin.so +0 -0
  16. roksta/roksta.cpython-311-darwin.so +0 -0
  17. roksta/select_files.cpython-311-darwin.so +0 -0
  18. roksta/tips.cpython-311-darwin.so +0 -0
  19. roksta/utils.cpython-311-darwin.so +0 -0
  20. roksta/write_code.cpython-311-darwin.so +0 -0
  21. {roksta-0.3.1.dist-info → roksta-0.3.2.dist-info}/METADATA +1 -1
  22. {roksta-0.3.1.dist-info → roksta-0.3.2.dist-info}/RECORD +37 -25
  23. tests/functions/api_v1_02/__init__.py +2 -0
  24. tests/functions/api_v1_02/test__analytics.py +416 -0
  25. tests/functions/api_v1_02/test__gemini_proxy.py +352 -0
  26. tests/functions/api_v1_02/test__generic_proxy.py +428 -0
  27. tests/functions/api_v1_02/test__get_payment_details.py +356 -0
  28. tests/functions/api_v1_02/test__openai_proxy.py +449 -0
  29. tests/functions/api_v1_02/test__redeem_credit_code.py +167 -0
  30. tests/functions/api_v1_02/test__sync_emails.py +325 -0
  31. tests/functions/api_v1_02/test__take_payment.py +491 -0
  32. tests/functions/api_v1_02/test__use_activation_code.py +438 -0
  33. tests/functions/api_v1_02/test_proxy_keyword_replacement.py +557 -0
  34. tests/functions/api_v1_02/test_replace_keywords.py +74 -0
  35. {roksta-0.3.1.dist-info → roksta-0.3.2.dist-info}/WHEEL +0 -0
  36. {roksta-0.3.1.dist-info → roksta-0.3.2.dist-info}/entry_points.txt +0 -0
  37. {roksta-0.3.1.dist-info → roksta-0.3.2.dist-info}/top_level.txt +0 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: roksta
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: An AI coding assistant
5
5
  Author-email: Prash Naidu <prash@roksta.ai>
6
6
  Project-URL: Homepage, https://roksta.ai
@@ -1,40 +1,45 @@
1
+ roksta-0.3.2.dist-info/RECORD,,
2
+ roksta-0.3.2.dist-info/WHEEL,sha256=VWNc5NH4DDoQDkc74R-nMZPza3RGJ6ac2abjVbvC-0k,141
3
+ roksta-0.3.2.dist-info/entry_points.txt,sha256=mzRdYg_DlzZRwjxYUt9-gyoRCkM1QBTeTbwETgiTdGw,44
4
+ roksta-0.3.2.dist-info/top_level.txt,sha256=lvciNZQ1dPGXpiCLdWVXK03n9fKHjbQdwjqQbnUjeYM,13
5
+ roksta-0.3.2.dist-info/METADATA,sha256=XgnSDc8MqytQD1jnmYC-tuyMdYvoa0MPRR_JP-ugZbg,1456
1
6
  roksta/logger.cpython-311-darwin.so,sha256=xch275vL4nC3HeSUxVdjTpnXmRXq2Jd1auVsd-a3bNs,122016
2
- roksta/lint_code.cpython-311-darwin.so,sha256=E4X_z2f8hE7eL0fM1Yaky8CSd0tEN3tOrzW7AET7N8A,224432
7
+ roksta/lint_code.cpython-311-darwin.so,sha256=6lSjs-uw6m3hVmhZS6QlFnd6jskgSk7xm178ag-Yx2I,207920
3
8
  roksta/get_codebase_structure.cpython-311-darwin.so,sha256=gFFoEJU2H9vJgmbRWjcqY2tSqc_7eUJPWIGTDgSQZk4,189984
4
9
  roksta/checkpoints.cpython-311-darwin.so,sha256=4vZMS8o8V6fez18V-ln64U4tXsOBPqbGgLE7pyYhZkQ,238032
5
10
  roksta/extended_text_area.cpython-311-darwin.so,sha256=hPsQ9DKb5Hqsl0QjVSZMvPc-DYkneWCOcUp7gN3BLNc,290904
6
11
  roksta/firebase_config.cpython-311-darwin.so,sha256=BKPNge6g8lDyI4M6dAxXVasD1T-j9stNUT--pB-AGT8,86568
7
- roksta/init_codebase.cpython-311-darwin.so,sha256=P9kuJXGfk4uk9VnGozUvnOyP66V0PZ4xbSS22N7i890,275024
12
+ roksta/init_codebase.cpython-311-darwin.so,sha256=zkIyCBplbsLfHDScvB_fD04d-rE640B3yEAUJOuAa4Y,308400
8
13
  roksta/gen_one_line_goal.cpython-311-darwin.so,sha256=LGggcZkhy9W8RTUIzj9vcACw0KZs7Big3_TpTXE3IZc,207560
9
- roksta/new_features.cpython-311-darwin.so,sha256=NHg_J74tB0CkgwGNtDr0LYgXQEOpCZSh-NKcDVLXL4U,85632
14
+ roksta/new_features.cpython-311-darwin.so,sha256=6X3c1I7MJS-JoX6xUtAll2_WOkdLn8Ol-eJhDozoNbw,85632
10
15
  roksta/chat_workflow.cpython-311-darwin.so,sha256=uQ4mon110StmmfbIALtZ9JOI76d6yIqOu_WUsxZLbgw,257232
11
- roksta/select_files.cpython-311-darwin.so,sha256=Qbce978o2zTA1wLVw2pHtNvhJJWhhUGHRuC5C57H_XM,207600
16
+ roksta/select_files.cpython-311-darwin.so,sha256=3kmwxH1UysuYKBc10m7FqHfO-pWe0Ybpxoc8o3BDhmA,207600
12
17
  roksta/parse_readme.cpython-311-darwin.so,sha256=2vXGMqTmmn9vm1twZkudrs4IXL6RTm0TYBcJwUlY0_E,207088
13
18
  roksta/firebase.cpython-311-darwin.so,sha256=bsMQ26yMRkpO24ADGhxOWKShbjh2fpcrWJXpXGFJXRw,471616
14
- roksta/goal_workflow.cpython-311-darwin.so,sha256=lLuivujF8JktdLw6SBEycsRa3obAF1pE9KrbwHYgn40,505312
15
- roksta/tips.cpython-311-darwin.so,sha256=LM8AJ59as_bZMa2rFdMogsKfc6yIk9YaH-hs6HxAItA,85592
16
- roksta/write_code.cpython-311-darwin.so,sha256=U_6AsReL8Kxv8TwuscxLySI4jL7dQa-rFgft7kLeYCQ,190944
19
+ roksta/goal_workflow.cpython-311-darwin.so,sha256=CiCCgwXMqFo1IyYtGu9XtrWNztSLXhZ_o9lfFETobSc,505312
20
+ roksta/tips.cpython-311-darwin.so,sha256=EYg4qd9vQ1_x0KahqcYXEmhjf4u2fDHvMPkDhcN-4Ss,85592
21
+ roksta/write_code.cpython-311-darwin.so,sha256=ShK28eVTEfMesKW8GrdW0V7dBBVcKvbdj_En9LV2jZ4,190944
17
22
  roksta/enums.cpython-311-darwin.so,sha256=rGABZEs5M_6PDdxssR9-gwfDhqMoor9kOyoxf79VFnI,404232
18
23
  roksta/analytics.cpython-311-darwin.so,sha256=lXYObBh_e8QiM7PQHipcKWtl5sD04ygEi71p2dvtc9k,256576
19
24
  roksta/main.cpython-311-darwin.so,sha256=LFCeVyu9__bUV9SuSuHyvHvZb0NU95H2LyesUHHref0,122152
20
25
  roksta/response_formats.cpython-311-darwin.so,sha256=BthAKv6MpQLL6SPni865ADEgw9VQwy-w1kgEEev-xGY,153928
21
- roksta/check_for_updates.cpython-311-darwin.so,sha256=quPqiJn9zI5elA4bJ5l3u9x_o-tpzpTVkfq2meCAqNA,290200
22
- roksta/utils.cpython-311-darwin.so,sha256=bwm3pRF1Mba2k-IjlLadSCEsu_vdMw22X49gtRy0oMU,588840
23
- roksta/fix_tests.cpython-311-darwin.so,sha256=ubc0XdINbsNRkJMvit4ZdNV9F5M0ovWg3udsSUdxtOk,223984
26
+ roksta/check_for_updates.cpython-311-darwin.so,sha256=WecZ1t8qGQfpWQpuMHVQ6CamNhFtfuuWXZ6G1gP0ntI,290200
27
+ roksta/utils.cpython-311-darwin.so,sha256=XVgHddZSStNGmfoNKelCr_RA59_4qgTGXMT9zD0mhp8,605352
28
+ roksta/fix_tests.cpython-311-darwin.so,sha256=e7JDWuf7wUAwqXl3NHrhT9M_BM6vTWcMpSS68wgSfBA,223984
24
29
  roksta/firebase_auth_web.cpython-311-darwin.so,sha256=U51PxZ0Qocf5yE5WfMacrIC2VAvYqRxraf5DvKAeNfM,439656
25
- roksta/env.cpython-311-darwin.so,sha256=oG0EODSUDwHXQXVh6VbnoYs9AxtI_Dm02Au4r2qC6yE,87992
30
+ roksta/env.cpython-311-darwin.so,sha256=lD1IGITMWkXR_JDzLujTQubrc2_TyDZzPSItiXekUsw,87992
26
31
  roksta/get_failing_tests.cpython-311-darwin.so,sha256=1jvAcZKA8gsnsrq6-HNsro-rQkqesYZIi9nKhf8g5m8,207576
27
- roksta/clarify_goal.cpython-311-darwin.so,sha256=9GRKv1QrjNCoulhg7BxAMwKItzLaI1XGcADo0lFCaYY,207616
28
- roksta/roksta.cpython-311-darwin.so,sha256=2biHt294CjfIxKDT8mQ69jXTtADaCg_JGQO75LimWq4,555120
32
+ roksta/clarify_goal.cpython-311-darwin.so,sha256=hvrnJAqt5XA3-ddDTUzEWMwHr4qc5giJx-I_m43v9lc,191232
33
+ roksta/roksta.cpython-311-darwin.so,sha256=ltrItSAV4smydDxHcj7XZVZAjZWjrZ3mWbsLCPuF03o,555120
29
34
  roksta/build_project.cpython-311-darwin.so,sha256=vUvI_82FBp5at73GbjzytM40VdyuxNrMSoy-TF0_hW0,190992
30
35
  roksta/rewrite_goal.cpython-311-darwin.so,sha256=Ef34h7nGUNKgGcRQY2EKLKkSrcNLKp4xzKE9JTmg6QY,174512
31
36
  roksta/run_cli_goal.cpython-311-darwin.so,sha256=mIDRX9GJIZUYock-CE_VUBvR-zLvYAkXQRCCdMUXlU4,207120
32
37
  roksta/codebase_listing.cpython-311-darwin.so,sha256=yqwkwIMP3MKag60iU2LEYWt36jCXgjmnFL7UuKiUUaQ,155656
33
38
  roksta/default_config.cpython-311-darwin.so,sha256=okjKjvIXlHp_m_82TZIFdMT9fgEAfr1R3EodQhIX564,102152
34
39
  roksta/__init__.cpython-311-darwin.so,sha256=0ErvE_Ab31A1ApkmxEhfJuljCTrEA6VccImUD3_9z8U,85488
35
- roksta/create_default_config.cpython-311-darwin.so,sha256=6XuYR51E9xZ54eSdTRZzlsN1ywGP5EuVUTHnC6L0ljU,121672
40
+ roksta/create_default_config.cpython-311-darwin.so,sha256=8XKJkl0wIXVr2tiyhgA_BDiJ6-jumjzxDcehxWq9cYo,121656
36
41
  roksta/make_issue.cpython-311-darwin.so,sha256=sPSYITShHG4HpdqDow8XbLhADJ-as4J4Jl_bviKOx0Q,222064
37
- roksta/propose_solution.cpython-311-darwin.so,sha256=wCKK0fp40j_ewRIzxF1PYqmUGkE3i4iGnp6tTB0A9Vc,190920
42
+ roksta/propose_solution.cpython-311-darwin.so,sha256=TWGxScLzLPTpijeCxfjkKFuTEY1YD6_ILhNK1GgRuqM,190920
38
43
  roksta/balance.cpython-311-darwin.so,sha256=VtXA6plincv8iIgiqYjhEsKf5n8egbt3EeZDujzfejs,389536
39
44
  roksta/gen_codebase_summaries.cpython-311-darwin.so,sha256=KYIPW6UaQV_XJEMttZHuUCyyHlPAQDVOvZwMNr2SIzg,621328
40
45
  roksta/command_handlers/handle_goal_command.cpython-311-darwin.so,sha256=HKsEAcRKIzeOXsQh_ELLIlO1Tn87rn6Iztd2OP0PWi8,157080
@@ -42,22 +47,22 @@ roksta/command_handlers/handle_quit_command.cpython-311-darwin.so,sha256=fR56AJ2
42
47
  roksta/command_handlers/handle_payment_details_command.cpython-311-darwin.so,sha256=7feybmTcI2KUbH0xiKDjxgOMlRnTZC7cTUuwgBcOOOE,173464
43
48
  roksta/command_handlers/handle_request_activation_command.cpython-311-darwin.so,sha256=tnoUINf47lvZzBRziVlv0gHPQFzXKEdwDoFt9KbRsYw,206920
44
49
  roksta/command_handlers/handle_feedback_command.cpython-311-darwin.so,sha256=plXKfXFR9EgR0IZ4RtphZPrGtHEyrdnCG1DIE6xNAQc,190240
45
- roksta/command_handlers/handle_testing_command.cpython-311-darwin.so,sha256=OA5q7Osrk8MGb-ChQhWto_pHkZ5JTMfIv9K_YqB1RKk,156016
50
+ roksta/command_handlers/handle_testing_command.cpython-311-darwin.so,sha256=BF5TjoweefIIWfItkxIma1Lo4nrSB49X9r_QvRDknWw,156016
46
51
  roksta/command_handlers/handle_chat_command.cpython-311-darwin.so,sha256=3_QJ4Iz4-nudRDMYWzhi7mnujrakmQ-8Rbv4Hcs1jt0,156632
47
52
  roksta/command_handlers/handle_init_command.cpython-311-darwin.so,sha256=KeaaNZ35JHAobBKZADxk-KpOLcX7lqOF7wvPHyDIliU,157064
48
53
  roksta/command_handlers/handle_activate_command.cpython-311-darwin.so,sha256=b6KTsnjifBgDajxnHFHhkXgnmpYzWz2AT_ZgbWsJ1EE,240256
49
54
  roksta/command_handlers/handle_login_command.cpython-311-darwin.so,sha256=IpbeFewFpDfP1lnOGSmj7hHLNx0WG5JrSLymbLamQ3U,207032
50
- roksta/command_handlers/handle_dev_rate_command.cpython-311-darwin.so,sha256=E6qpsG_dxh9MzqPfZRHMz90r-LJxt949Ydlrrj07eKE,123008
51
- roksta/command_handlers/handle_linting_command.cpython-311-darwin.so,sha256=pPyN7t7NExmPLRfwbI5xp2zMyqT33e-HI1JVZq_ETbs,156016
55
+ roksta/command_handlers/handle_dev_rate_command.cpython-311-darwin.so,sha256=g4DPbDawA0cSdYxsh405vl9jeOD2-pLaTBG5umMvXEs,123008
56
+ roksta/command_handlers/handle_linting_command.cpython-311-darwin.so,sha256=qlKlwYSW64qXXO-41MpZg-g_MzgtU9foV09mmN-Jipg,156016
52
57
  roksta/command_handlers/handle_help_command.cpython-311-darwin.so,sha256=TT9unIC2ecyomkRAZjg0W8WZOEVsrMXJaDoruBz0xOc,253160
53
- roksta/command_handlers/handle_auto_commit_command.cpython-311-darwin.so,sha256=0oLYqO33_ofrl_MhLl3DKGqU8CJinhnMMWBtUrG4yu0,122528
58
+ roksta/command_handlers/handle_auto_commit_command.cpython-311-darwin.so,sha256=mCzSmi2eSzhKMPxQh_eVljRdFoysNSz8l6WarlO-4oI,122512
54
59
  roksta/command_handlers/handle_add_funds_command.cpython-311-darwin.so,sha256=bzmPLTlKyg39Zb4XDdFsKOo6U13frwqIKtTyP-DVauc,207792
55
60
  roksta/command_handlers/__init__.cpython-311-darwin.so,sha256=g0IaXlbYKxBp04YtfYnncYV7NczDDSuBFqLDWnNGXcg,86176
56
61
  roksta/command_handlers/handle_logout_command.cpython-311-darwin.so,sha256=DusVzoMddXp1AdlDnaTlE9KsquuQnqymA7_sDZXvrwA,121608
57
62
  roksta/command_handlers/handle_auto_charge_command.cpython-311-darwin.so,sha256=dtim1-R2jM56qfBmHolpsAWddYnUgFvRHmoYEzttgIM,156480
58
63
  roksta/command_handlers/handle_usage_command.cpython-311-darwin.so,sha256=UeAh5EgYp0WJHTlOky66CRm1F09-nq3r80HgMDaKe4U,207880
59
64
  roksta/command_handlers/handle_redeem_command.cpython-311-darwin.so,sha256=hDiLfcQiSSn4P8gZmZWGTW1LtQtbsim-VvJmi8SeluE,157592
60
- roksta/command_handlers/handle_building_command.cpython-311-darwin.so,sha256=7eYIDWjEeJ_zq-uMENmQfFJFW0mz-lGtDtCzb6YkB8s,156016
65
+ roksta/command_handlers/handle_building_command.cpython-311-darwin.so,sha256=4Um5FdVi6zIs_e3o9U-2MAgDCrNgvhgZXXiuri-sMjM,156016
61
66
  roksta/ai/openai.cpython-311-darwin.so,sha256=KenHrHkUb1R3-XQnzui6dWIOqObeITzx95e2m_LYbm0,290352
62
67
  roksta/ai/call_ai.cpython-311-darwin.so,sha256=B3n-xiMlSb_QWeBCZm27fbWsFJGxKfJ9D7JuMCd5B84,224048
63
68
  roksta/ai/llm.cpython-311-darwin.so,sha256=T4egotoBbjHDoJybP0hb4uISN3etJhoNMaedj9Ypk6c,288232
@@ -82,6 +87,18 @@ tests/functions/test_utils.py,sha256=_zlgSa99JYVyJ0LDe3yaPztS92kqGRKkgjon__XmfFM
82
87
  tests/functions/test_auth.py,sha256=I3oFTw2LTuUsnQ75v5SCfgUPnpel_pDKqUH0VAJpXQw,992
83
88
  tests/functions/__init__.py,sha256=mLXx3UARcv07vs_fGJuy3L5ZRn9IRsF9zIuL5IOnwdk,95
84
89
  tests/functions/test_main.py,sha256=h0W_4ISo95WzRy2HpXZw3cuNOTcYk_2QCIZffZJEfEU,2575
90
+ tests/functions/api_v1_02/test__sync_emails.py,sha256=OTyf2YbBK7e4pWIQTUGYR4x6il1Hb3g4FYqQ_fRj1nA,12699
91
+ tests/functions/api_v1_02/test__take_payment.py,sha256=I-XJasGuLW5wTMAu4nAgFkA8Mo_zVpGPvkJ2LrrJGCk,18022
92
+ tests/functions/api_v1_02/test_replace_keywords.py,sha256=pa7bZ8I9XgtI5dUZq-efcHh9amN2_XHP8abXYqtDGc0,2683
93
+ tests/functions/api_v1_02/test__gemini_proxy.py,sha256=mf8ubRmNxxxN80H6EA-iDPwu6Oue6Rmgxl6tiFNpfrU,13344
94
+ tests/functions/api_v1_02/test_proxy_keyword_replacement.py,sha256=I5H73_QydSKLiDp7hDHGHbSkDOdv-BT4gYHGqEiVtM0,23632
95
+ tests/functions/api_v1_02/test__analytics.py,sha256=oKjd7_zjnttcb-5BuA93yllkm0OOF4YWnfTUW1-icnM,15806
96
+ tests/functions/api_v1_02/__init__.py,sha256=3RCSoj_5UQPw9Z5NeAgYz2s4gfcZIi7g36qk_Ed5TiA,124
97
+ tests/functions/api_v1_02/test__use_activation_code.py,sha256=tNyTkkRtrpjei-7F31UNwrcU-PbP-QnkWNU7h2n5Yqo,16960
98
+ tests/functions/api_v1_02/test__redeem_credit_code.py,sha256=7GD3tGgO2Lk0BCjUmzZACJiwocEhLBvXrrut0x13IWU,6347
99
+ tests/functions/api_v1_02/test__openai_proxy.py,sha256=xlO2zmG64LlrKrbjFz-ds6Map7vy4SjIuHfZJDAqGK8,17726
100
+ tests/functions/api_v1_02/test__get_payment_details.py,sha256=i5Px3NkLxqw8D3tVPrYdRJJF5jlNmysSuX_NNolbIa4,13735
101
+ tests/functions/api_v1_02/test__generic_proxy.py,sha256=KZkOtmc71aOnWlz2L7B6CFhRNEV73bExG3GR14oD2L0,17673
85
102
  tests/functions/api_v1_01/test__sync_emails.py,sha256=OTyf2YbBK7e4pWIQTUGYR4x6il1Hb3g4FYqQ_fRj1nA,12699
86
103
  tests/functions/api_v1_01/test__take_payment.py,sha256=I-XJasGuLW5wTMAu4nAgFkA8Mo_zVpGPvkJ2LrrJGCk,18022
87
104
  tests/functions/api_v1_01/test__gemini_proxy.py,sha256=mf8ubRmNxxxN80H6EA-iDPwu6Oue6Rmgxl6tiFNpfrU,13344
@@ -102,8 +119,3 @@ tests/functions/api_v1_00/test__redeem_credit_code.py,sha256=7GD3tGgO2Lk0BCjUmzZ
102
119
  tests/functions/api_v1_00/test__openai_proxy.py,sha256=xlO2zmG64LlrKrbjFz-ds6Map7vy4SjIuHfZJDAqGK8,17726
103
120
  tests/functions/api_v1_00/test__get_payment_details.py,sha256=i5Px3NkLxqw8D3tVPrYdRJJF5jlNmysSuX_NNolbIa4,13735
104
121
  tests/functions/api_v1_00/test__generic_proxy.py,sha256=KZkOtmc71aOnWlz2L7B6CFhRNEV73bExG3GR14oD2L0,17673
105
- roksta-0.3.1.dist-info/RECORD,,
106
- roksta-0.3.1.dist-info/WHEEL,sha256=VWNc5NH4DDoQDkc74R-nMZPza3RGJ6ac2abjVbvC-0k,141
107
- roksta-0.3.1.dist-info/entry_points.txt,sha256=mzRdYg_DlzZRwjxYUt9-gyoRCkM1QBTeTbwETgiTdGw,44
108
- roksta-0.3.1.dist-info/top_level.txt,sha256=lvciNZQ1dPGXpiCLdWVXK03n9fKHjbQdwjqQbnUjeYM,13
109
- roksta-0.3.1.dist-info/METADATA,sha256=l3i3WQqIWKNwBVYQ1Eaw_1pZfMrIxEqQWipD2s_xId0,1456
@@ -0,0 +1,2 @@
1
+ # tests.functions.api_v1_00 package marker
2
+ # Allows tests under this directory to be imported with package-qualified names.
@@ -0,0 +1,416 @@
1
+ import os
2
+ import sys
3
+ import json
4
+ import types
5
+ import importlib
6
+ from unittest.mock import patch, Mock
7
+
8
+
9
+ # Ensure the functions/ directory is importable as a top-level module location
10
+ PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
11
+ FUNCTIONS_DIR = os.path.join(PROJECT_ROOT, 'functions')
12
+ if FUNCTIONS_DIR not in sys.path:
13
+ sys.path.insert(0, FUNCTIONS_DIR)
14
+
15
+ # -----------------------------
16
+ # Provide lightweight fake modules to satisfy imports inside _analytics
17
+ # These are minimal and will be patched in individual tests as needed.
18
+ # -----------------------------
19
+ # Save any originals so we can restore them after import
20
+ _orig_sys_modules = {}
21
+ _names_to_fake = ['firebase_functions', 'utils', 'auth', 'httpx']
22
+ for name in _names_to_fake:
23
+ _orig_sys_modules[name] = sys.modules.get(name)
24
+
25
+ # Fake firebase_functions.https_fn.Response to capture returned data
26
+ firebase_functions = types.ModuleType('firebase_functions')
27
+
28
+ class FakeResponse:
29
+ def __init__(self, response=None, mimetype=None, status=200, **kwargs):
30
+ # Mirror the small subset of the interface tests expect
31
+ self.status_code = status
32
+ if isinstance(response, (dict, list)):
33
+ self._body_text = json.dumps(response)
34
+ else:
35
+ self._body_text = '' if response is None else response
36
+ self.headers = kwargs.get('headers', {})
37
+
38
+ def get_data(self, as_text=False):
39
+ if as_text:
40
+ return self._body_text
41
+ return self._body_text.encode('utf-8')
42
+
43
+ firebase_functions.https_fn = types.SimpleNamespace(Request=object, Response=FakeResponse)
44
+ sys.modules['firebase_functions'] = firebase_functions
45
+
46
+ # Fake utils module (avoid google.cloud import at module import time)
47
+ utils_mod = types.ModuleType('utils')
48
+
49
+ def _dummy_get_secret_key(name: str) -> str:
50
+ return 'DUMMY_SECRET'
51
+
52
+ # create_json_response should return a firebase_functions.https_fn.Response-like object
53
+ # with a JSON body containing at least 'success' and 'message' keys, and an HTTP status code.
54
+ def _dummy_create_json_response(success: bool, payload, status_code: int = 200, headers: dict | None = None):
55
+ body = {'success': success, 'message': payload}
56
+ return firebase_functions.https_fn.Response(response=body, status=status_code, headers=headers or {})
57
+
58
+ utils_mod.get_secret_key = _dummy_get_secret_key
59
+ utils_mod.create_json_response = _dummy_create_json_response
60
+ sys.modules['utils'] = utils_mod
61
+
62
+ # Fake auth module (validate_auth_key will be patched per-test as needed)
63
+ auth_mod = types.ModuleType('auth')
64
+
65
+ def _simple_validate_auth_key(val: str) -> bool:
66
+ return bool(val)
67
+
68
+ auth_mod.validate_auth_key = _simple_validate_auth_key
69
+ sys.modules['auth'] = auth_mod
70
+
71
+ # Fake httpx module to avoid external dependency; tests will patch Client behavior
72
+ httpx_mod = types.ModuleType('httpx')
73
+
74
+ class Request:
75
+ def __init__(self, method, url, headers=None, content=None):
76
+ self.method = method
77
+ self.url = url
78
+ self.headers = headers or {}
79
+ self.content = content
80
+
81
+ class _DummyResponse:
82
+ def __init__(self, status_code=200, text='', json_data=None, request=None, headers=None):
83
+ self.status_code = status_code
84
+ self.text = text if text is not None else ''
85
+ self._json = json_data
86
+ self.request = request
87
+ self.headers = headers or {}
88
+ # Provide a reason_phrase attribute similar to real httpx.Response
89
+ self.reason_phrase = self.text or ''
90
+
91
+ def json(self):
92
+ # Prefer explicit JSON payload if provided, otherwise try to parse text
93
+ if self._json is not None:
94
+ return self._json
95
+ try:
96
+ return json.loads(self.text) if self.text else {}
97
+ except Exception:
98
+ return {}
99
+
100
+ def raise_for_status(self):
101
+ if 400 <= self.status_code:
102
+ raise httpx_mod.HTTPStatusError(response=self)
103
+
104
+ class _DummyHttpxClient:
105
+ def __enter__(self):
106
+ return self
107
+
108
+ def __exit__(self, exc_type, exc, tb):
109
+ return False
110
+
111
+ def post(self, url, json=None, timeout=30):
112
+ resp = _DummyResponse(status_code=200, text='', json_data=None)
113
+ resp.raise_for_status = Mock(return_value=None)
114
+ resp.json = Mock(return_value={})
115
+ return resp
116
+
117
+ class _DummyAsyncClient:
118
+ async def __aenter__(self):
119
+ return self
120
+
121
+ async def __aexit__(self, exc_type, exc, tb):
122
+ return False
123
+
124
+ async def get(self, url, headers=None, timeout=None):
125
+ resp = _DummyResponse(status_code=200, text='', json_data=None)
126
+ resp.raise_for_status = Mock(return_value=None)
127
+ resp.json = Mock(return_value={})
128
+ return resp
129
+
130
+ async def post(self, url, json=None, data=None, headers=None, timeout=None):
131
+ resp = _DummyResponse(status_code=200, text='', json_data=None)
132
+ resp.raise_for_status = Mock(return_value=None)
133
+ resp.json = Mock(return_value={})
134
+ return resp
135
+
136
+ httpx_mod.Client = _DummyHttpxClient
137
+ httpx_mod.AsyncClient = _DummyAsyncClient
138
+ httpx_mod.Response = _DummyResponse
139
+ httpx_mod.Request = Request
140
+ httpx_mod.Headers = dict
141
+
142
+ class _HTTPStatusError(Exception):
143
+ def __init__(self, *args, request=None, response=None):
144
+ # Support both signatures:
145
+ # HTTPStatusError(response)
146
+ # HTTPStatusError(message, request=..., response=...)
147
+ message = ""
148
+ if response is None and len(args) == 1 and not isinstance(args[0], str):
149
+ # Single positional non-string arg -> treated as response
150
+ response = args[0]
151
+ elif len(args) >= 1 and isinstance(args[0], str):
152
+ message = args[0]
153
+ elif len(args) > 1:
154
+ message = args[0]
155
+ super().__init__(message)
156
+ self.request = request
157
+ self.response = response
158
+
159
+ def __str__(self):
160
+ try:
161
+ return f"{self.args[0]} (status={getattr(self.response,'status_code',None)})"
162
+ except Exception:
163
+ return self.args[0] if self.args else "HTTPStatusError"
164
+
165
+ class _RequestError(Exception):
166
+ def __init__(self, message="", request=None):
167
+ super().__init__(message)
168
+ self.request = request
169
+
170
+ httpx_mod.HTTPStatusError = _HTTPStatusError
171
+ httpx_mod.RequestError = _RequestError
172
+ sys.modules['httpx'] = httpx_mod
173
+
174
+ # -----------------------------
175
+ # Import the module under test after preparing the fake imports
176
+ # -----------------------------
177
+ repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
178
+ functions_root = os.path.join(repo_root, 'functions')
179
+ module_path = os.path.join(functions_root, 'api_v1_00', '_analytics.py')
180
+ spec = importlib.util.spec_from_file_location('api_v1_00._analytics', module_path)
181
+ _analytics = importlib.util.module_from_spec(spec)
182
+ spec.loader.exec_module(_analytics)
183
+
184
+ # Restore original sys.modules mappings to avoid side-effects for other tests
185
+ for name, orig in _orig_sys_modules.items():
186
+ if orig is None:
187
+ try:
188
+ del sys.modules[name]
189
+ except KeyError:
190
+ pass
191
+ else:
192
+ sys.modules[name] = orig
193
+
194
+ # Simple helper request stub used in the tests
195
+ class DummyRequest:
196
+ def __init__(self, headers=None, method='POST', json_data=None, raise_on_get_json=False):
197
+ self.headers = headers or {}
198
+ self.method = method
199
+ self._json_data = json_data
200
+ self._raise = raise_on_get_json
201
+
202
+ def get_json(self, silent=False):
203
+ if self._raise:
204
+ raise Exception('Malformed JSON')
205
+ return self._json_data
206
+
207
+
208
+ def _parse_response(resp):
209
+ data = resp.get_data(as_text=True)
210
+ return json.loads(data)
211
+
212
+
213
+ # -----------------------------
214
+ # Tests
215
+ # -----------------------------
216
+
217
+ def test_missing_auth_header_returns_401():
218
+ req = DummyRequest(headers={}, method='POST')
219
+ resp = _analytics._analytics(req)
220
+ assert resp.status_code == 401
221
+ payload = _parse_response(resp)
222
+ assert payload['success'] is False
223
+ assert 'Missing authentication key' in payload['message']
224
+
225
+
226
+ def test_invalid_auth_key_returns_403():
227
+ headers = {_analytics.AUTH_HEADER_NAME: 'bad-token'}
228
+ req = DummyRequest(headers=headers, method='POST')
229
+ with patch.object(_analytics, 'validate_auth_key', return_value=False):
230
+ resp = _analytics._analytics(req)
231
+ assert resp.status_code == 403
232
+ payload = _parse_response(resp)
233
+ assert payload['success'] is False
234
+ assert 'Invalid authentication key' in payload['message']
235
+
236
+
237
+ def test_non_post_method_returns_405():
238
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
239
+ req = DummyRequest(headers=headers, method='GET')
240
+ with patch.object(_analytics, 'validate_auth_key', return_value=True):
241
+ resp = _analytics._analytics(req)
242
+ assert resp.status_code == 405
243
+ payload = _parse_response(resp)
244
+ assert payload['success'] is False
245
+ assert 'POST method required' in payload['message']
246
+
247
+
248
+ def test_malformed_json_returns_400():
249
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
250
+ req = DummyRequest(headers=headers, method='POST', raise_on_get_json=True)
251
+ with patch.object(_analytics, 'validate_auth_key', return_value=True):
252
+ resp = _analytics._analytics(req)
253
+ assert resp.status_code == 400
254
+ payload = _parse_response(resp)
255
+ assert payload['success'] is False
256
+ assert 'Invalid JSON payload' in payload['message']
257
+
258
+
259
+ def test_missing_required_fields_returns_400():
260
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
261
+ # missing measurement_id
262
+ req = DummyRequest(headers=headers, method='POST', json_data={'client_id': 'c', 'events': [{'name': 'e'}]})
263
+ with patch.object(_analytics, 'validate_auth_key', return_value=True):
264
+ resp = _analytics._analytics(req)
265
+ assert resp.status_code == 400
266
+ payload = _parse_response(resp)
267
+ assert payload['success'] is False
268
+ assert 'Missing required fields' in payload['message']
269
+
270
+
271
+ def test_invalid_events_field_returns_400_for_empty_or_non_list():
272
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
273
+
274
+ # events is empty list
275
+ req_empty = DummyRequest(headers=headers, method='POST', json_data={'measurement_id': 'm', 'client_id': 'c', 'events': []})
276
+ with patch.object(_analytics, 'validate_auth_key', return_value=True):
277
+ resp = _analytics._analytics(req_empty)
278
+ assert resp.status_code == 400
279
+ payload = _parse_response(resp)
280
+ assert payload['success'] is False
281
+ assert 'Missing required fields' in payload['message']
282
+
283
+ # events is not a list
284
+ req_not_list = DummyRequest(headers=headers, method='POST', json_data={'measurement_id': 'm', 'client_id': 'c', 'events': 'nope'})
285
+ with patch.object(_analytics, 'validate_auth_key', return_value=True):
286
+ resp = _analytics._analytics(req_not_list)
287
+ assert resp.status_code == 400
288
+ payload = _parse_response(resp)
289
+ assert payload['success'] is False
290
+ assert "'events' field must be a non-empty list" in payload['message']
291
+
292
+
293
+ def test_secret_retrieval_failure_returns_500():
294
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
295
+ req_payload = {'measurement_id': 'm', 'client_id': 'c', 'events': [{'name': 'e'}]}
296
+ req = DummyRequest(headers=headers, method='POST', json_data=req_payload)
297
+ with patch.object(_analytics, 'validate_auth_key', return_value=True), patch.object(_analytics, 'get_secret_key', side_effect=Exception('boom')):
298
+ resp = _analytics._analytics(req)
299
+ assert resp.status_code == 500
300
+ payload = _parse_response(resp)
301
+ assert payload['success'] is False
302
+ assert 'Could not retrieve GA secret' in payload['message']
303
+
304
+
305
+ def test_successful_flow_calls_httpx_with_expected_url_and_payload():
306
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
307
+ measurement_id = 'MEAS_ABC'
308
+ client_id = 'roksta_console'
309
+ events = [{'name': 'evt', 'params': {'a': 1}}]
310
+ user_id = 'user-123'
311
+ req_payload = {'measurement_id': measurement_id, 'client_id': client_id, 'events': events, 'user_id': user_id}
312
+ req = DummyRequest(headers=headers, method='POST', json_data=req_payload)
313
+
314
+ # Recording client to capture call details
315
+ class RecordingClient:
316
+ def __init__(self):
317
+ self.post_called = False
318
+ self.last_url = None
319
+ self.last_json = None
320
+ self.last_timeout = None
321
+
322
+ def __enter__(self):
323
+ return self
324
+
325
+ def __exit__(self, exc_type, exc, tb):
326
+ return False
327
+
328
+ def post(self, url, json=None, timeout=30):
329
+ self.post_called = True
330
+ self.last_url = url
331
+ self.last_json = json
332
+ self.last_timeout = timeout
333
+ resp = Mock()
334
+ resp.raise_for_status = Mock(return_value=None)
335
+ resp.status_code = 200
336
+ resp.text = ''
337
+ return resp
338
+
339
+ recording = RecordingClient()
340
+
341
+ with patch.object(_analytics, 'validate_auth_key', return_value=True), \
342
+ patch.object(_analytics, 'get_secret_key', return_value='GA-SECRET'), \
343
+ patch.object(_analytics.httpx, 'Client', return_value=recording):
344
+ resp = _analytics._analytics(req)
345
+
346
+ assert resp.status_code == 200
347
+ payload = _parse_response(resp)
348
+ assert payload['success'] is True
349
+
350
+ expected_url = f"https://www.google-analytics.com/mp/collect?measurement_id={measurement_id}&api_secret=GA-SECRET"
351
+ assert recording.post_called is True
352
+ assert recording.last_url == expected_url
353
+ assert recording.last_json['client_id'] == client_id
354
+ assert recording.last_json['events'] == events
355
+ assert recording.last_json['user_id'] == user_id
356
+
357
+
358
+ def test_httpx_http_status_error_is_logged_but_function_returns_200():
359
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
360
+ req_payload = {'measurement_id': 'm', 'client_id': 'c', 'events': [{'name': 'e'}]}
361
+ req = DummyRequest(headers=headers, method='POST', json_data=req_payload)
362
+
363
+ # Client that returns a response whose raise_for_status raises HTTPStatusError
364
+ class ErrClient1:
365
+ def __enter__(self):
366
+ return self
367
+
368
+ def __exit__(self, exc_type, exc, tb):
369
+ return False
370
+
371
+ def post(self, url, json=None, timeout=30):
372
+ resp = Mock()
373
+ # Raise a fake HTTPStatusError instance with a response attribute
374
+ resp.raise_for_status = Mock(side_effect=_analytics.httpx.HTTPStatusError(Mock(status_code=400, text='bad')))
375
+ resp.status_code = 400
376
+ resp.text = 'bad'
377
+ return resp
378
+
379
+ err_client = ErrClient1()
380
+
381
+ with patch.object(_analytics, 'validate_auth_key', return_value=True), \
382
+ patch.object(_analytics, 'get_secret_key', return_value='GA-SECRET'), \
383
+ patch.object(_analytics.httpx, 'Client', return_value=err_client):
384
+ resp = _analytics._analytics(req)
385
+
386
+ assert resp.status_code == 200
387
+ payload = _parse_response(resp)
388
+ assert payload['success'] is True
389
+
390
+
391
+ def test_httpx_request_error_is_logged_but_function_returns_200():
392
+ headers = {_analytics.AUTH_HEADER_NAME: 'ok'}
393
+ req_payload = {'measurement_id': 'm', 'client_id': 'c', 'events': [{'name': 'e'}]}
394
+ req = DummyRequest(headers=headers, method='POST', json_data=req_payload)
395
+
396
+ # Client whose post itself raises a RequestError
397
+ class ErrClient2:
398
+ def __enter__(self):
399
+ return self
400
+
401
+ def __exit__(self, exc_type, exc, tb):
402
+ return False
403
+
404
+ def post(self, url, json=None, timeout=30):
405
+ raise _analytics.httpx.RequestError('network')
406
+
407
+ err_client = ErrClient2()
408
+
409
+ with patch.object(_analytics, 'validate_auth_key', return_value=True), \
410
+ patch.object(_analytics, 'get_secret_key', return_value='GA-SECRET'), \
411
+ patch.object(_analytics.httpx, 'Client', return_value=err_client):
412
+ resp = _analytics._analytics(req)
413
+
414
+ assert resp.status_code == 200
415
+ payload = _parse_response(resp)
416
+ assert payload['success'] is True