@@ -1619,10 +1619,8 @@ def test_resolve_artifact_runtime_source_refs_uses_environment_token_fallback(se
16191619 "odoo_devkit.local_runtime.resolve_source_repository_ref_to_git_sha" ,
16201620 return_value = "411f6b8e85cac72dc7aa2e2dc5540001043c327d" ,
16211621 ) as resolve_ref_mock :
1622- resolved_values , selector_metadata = (
1623- local_runtime .resolve_artifact_runtime_source_repository_refs (
1624- runtime_values = runtime_values
1625- )
1622+ resolved_values , selector_metadata = local_runtime .resolve_artifact_runtime_source_repository_refs (
1623+ runtime_values = runtime_values
16261624 )
16271625
16281626 resolve_ref_mock .assert_called_once_with (
@@ -1645,6 +1643,52 @@ def test_resolve_artifact_runtime_source_refs_uses_environment_token_fallback(se
16451643 ),
16461644 )
16471645
1646+ def test_resolve_artifact_runtime_source_refs_uses_dedicated_source_token_env (self ) -> None :
1647+ runtime_values = {
1648+ "ODOO_ADDON_REPOSITORIES" : "cbusillo/disable_odoo_online@main" ,
1649+ }
1650+ with mock .patch .dict (
1651+ os .environ ,
1652+ {
1653+ "ODOO_DEVKIT_SOURCE_GITHUB_TOKEN" : "source-env-token" ,
1654+ "GITHUB_TOKEN" : "github-env-token" ,
1655+ },
1656+ ):
1657+ with mock .patch (
1658+ "odoo_devkit.local_runtime.resolve_source_repository_ref_to_git_sha" ,
1659+ return_value = "411f6b8e85cac72dc7aa2e2dc5540001043c327d" ,
1660+ ) as resolve_ref_mock :
1661+ local_runtime .resolve_artifact_runtime_source_repository_refs (runtime_values = runtime_values )
1662+
1663+ resolve_ref_mock .assert_called_once_with (
1664+ repository = "cbusillo/disable_odoo_online" ,
1665+ ref = "main" ,
1666+ github_token = "source-env-token" ,
1667+ )
1668+
1669+ def test_resolve_artifact_runtime_source_refs_supports_ci_source_token_env (self ) -> None :
1670+ runtime_values = {
1671+ "ODOO_ADDON_REPOSITORIES" : "cbusillo/disable_odoo_online@main" ,
1672+ }
1673+ with mock .patch .dict (
1674+ os .environ ,
1675+ {
1676+ "ODOO_SOURCE_GITHUB_TOKEN" : "ci-source-token" ,
1677+ "GITHUB_TOKEN" : "github-env-token" ,
1678+ },
1679+ ):
1680+ with mock .patch (
1681+ "odoo_devkit.local_runtime.resolve_source_repository_ref_to_git_sha" ,
1682+ return_value = "411f6b8e85cac72dc7aa2e2dc5540001043c327d" ,
1683+ ) as resolve_ref_mock :
1684+ local_runtime .resolve_artifact_runtime_source_repository_refs (runtime_values = runtime_values )
1685+
1686+ resolve_ref_mock .assert_called_once_with (
1687+ repository = "cbusillo/disable_odoo_online" ,
1688+ ref = "main" ,
1689+ github_token = "ci-source-token" ,
1690+ )
1691+
16481692 def test_resolve_artifact_runtime_source_refs_prefers_runtime_github_token (self ) -> None :
16491693 runtime_values = {
16501694 "GITHUB_TOKEN" : "source-token" ,
@@ -1655,9 +1699,7 @@ def test_resolve_artifact_runtime_source_refs_prefers_runtime_github_token(self)
16551699 "odoo_devkit.local_runtime.resolve_source_repository_ref_to_git_sha" ,
16561700 return_value = "411f6b8e85cac72dc7aa2e2dc5540001043c327d" ,
16571701 ) as resolve_ref_mock :
1658- local_runtime .resolve_artifact_runtime_source_repository_refs (
1659- runtime_values = runtime_values
1660- )
1702+ local_runtime .resolve_artifact_runtime_source_repository_refs (runtime_values = runtime_values )
16611703
16621704 resolve_ref_mock .assert_called_once_with (
16631705 repository = "cbusillo/disable_odoo_online" ,
0 commit comments