Skip to content

Commit

Permalink
fix function namespace if empty (#201)
Browse files Browse the repository at this point in the history
* fix function namespace if empty

* fix tests
  • Loading branch information
fzumstein authored Dec 8, 2024
1 parent 1158c67 commit 8be9715
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 4 additions & 0 deletions app/templates/manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
<Metadata>
<SourceLocation resid="Functions.Metadata.Url" />
</Metadata>
{% if settings.functions_namespace %}
<Namespace resid="Functions.Namespace" />
{% endif %}
</ExtensionPoint>
</AllFormFactors>

Expand Down Expand Up @@ -125,7 +127,9 @@
<bt:Url id="Functions.Metadata.Url" DefaultValue="{{ base_url_with_app_path }}/xlwings/custom-functions-meta.json" />
</bt:Urls>
<bt:ShortStrings>
{% if settings.functions_namespace %}
<bt:String id="Functions.Namespace" DefaultValue="{{ settings.functions_namespace|upper }}{{ '_' if settings.functions_namespace and settings.environment != 'prod'}}{{ settings.environment | upper if settings.environment != 'prod'}}" />
{% endif %}
<bt:String id="MyTab.TabLabel" DefaultValue="{{ settings.project_name }}{{ ' [' + settings.environment + ']' if settings.environment != 'prod'}}" />
<bt:String id="MyCommandsGroup.Label" DefaultValue="MyGroup" />
<bt:String id="MyFunctionButton.Label" DefaultValue="Hello World" />
Expand Down
10 changes: 2 additions & 8 deletions tests/test_router_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ def test_get_manifest_prod(mocker):
)


def test_empty_function_namespace_prod(mocker):
def test_empty_function_namespace(mocker):
mocker.patch.object(settings, "environment", "prod")
mocker.patch.object(settings, "functions_namespace", "")
response = client.get(f"{settings.app_path}/manifest")
assert '<bt:String id="Functions.Namespace" DefaultValue="" />' in response.text


def test_empty_function_namespace_nonprod(mocker):
mocker.patch.object(settings, "functions_namespace", "")
response = client.get(f"{settings.app_path}/manifest")
assert '<bt:String id="Functions.Namespace" DefaultValue="QA" />' in response.text
assert "Functions.Namespace" not in response.text


def test_entraid_auth_deactivated():
Expand Down

0 comments on commit 8be9715

Please sign in to comment.