Small fix for relative path and documentroot in staticfilemiddleware

This commit is contained in:
Daniele Teti 2020-05-02 17:06:59 +02:00
parent b642900431
commit 6c96a6ef3e
5 changed files with 33 additions and 34 deletions

View File

@ -124,9 +124,8 @@ constructor TMVCStaticFilesMiddleware.Create(
const AStaticFilesCharset: string = TMVCStaticFilesDefaults.STATIC_FILES_CONTENT_CHARSET);
begin
inherited Create;
fStaticFilesPath := AStaticFilesPath;
fDocumentRoot := ADocumentRoot;
fStaticFilesPath := AStaticFilesPath;
fDocumentRoot := TPath.Combine(AppPath, ADocumentRoot);
fIndexDocument := AIndexDocument;
fStaticFilesCharset := AStaticFilesCharset;
fSPAWebAppSupport := ASPAWebAppSupport;

View File

@ -252,34 +252,6 @@ def build_delphi_project_list(
return ret
@task
def tests(ctx, delphi_version=DEFAULT_DELPHI_VERSION):
"""Builds and execute the unit tests"""
import os
apppath = os.path.dirname(os.path.realpath(__file__))
res = True
testclient = r"unittests\general\Several\DMVCFrameworkTests.dproj"
testserver = r"unittests\general\TestServer\TestServer.dproj"
print("\nBuilding Unit Test client")
build_delphi_project(ctx, testclient, config="CI", delphi_version=delphi_version)
print("\nBuilding Test Server")
build_delphi_project(ctx, testserver, config="CI", delphi_version=delphi_version)
# import subprocess
# subprocess.run([r"unittests\general\TestServer\Win32\Debug\TestServer.exe"])
# os.spawnl(os.P_NOWAIT, r"unittests\general\TestServer\Win32\Debug\TestServer.exe")
import subprocess
print("\nExecuting tests...")
subprocess.Popen([r"unittests\general\TestServer\bin\TestServer.exe"])
r = subprocess.run([r"unittests\general\Several\bin\DMVCFrameworkTests.exe"])
subprocess.run(["taskkill", "/f", "/im", "TestServer.exe"])
if r.returncode > 0:
print(r)
return Exit("Unit tests failed")
@task
def clean(ctx, folder=None):
global g_output_folder
@ -322,6 +294,34 @@ def clean(ctx, folder=None):
rmtree(folder + r"\lib\swagdoc\deploy", True)
rmtree(folder + r"\lib\swagdoc\demos", True)
@task()
def tests(ctx, delphi_version=DEFAULT_DELPHI_VERSION):
"""Builds and execute the unit tests"""
import os
apppath = os.path.dirname(os.path.realpath(__file__))
res = True
testclient = r"unittests\general\Several\DMVCFrameworkTests.dproj"
testserver = r"unittests\general\TestServer\TestServer.dproj"
print("\nBuilding Unit Test client")
build_delphi_project(ctx, testclient, config="CI", delphi_version=delphi_version)
print("\nBuilding Test Server")
build_delphi_project(ctx, testserver, config="CI", delphi_version=delphi_version)
# import subprocess
# subprocess.run([r"unittests\general\TestServer\Win32\Debug\TestServer.exe"])
# os.spawnl(os.P_NOWAIT, r"unittests\general\TestServer\Win32\Debug\TestServer.exe")
import subprocess
print("\nExecuting tests...")
subprocess.Popen([r"unittests\general\TestServer\bin\TestServer.exe"])
r = subprocess.run([r"unittests\general\Several\bin\DMVCFrameworkTests.exe"])
subprocess.run(["taskkill", "/f", "/im", "TestServer.exe"])
if r.returncode > 0:
print(r)
print("Unit Tests Failed")
return Exit("Unit tests failed")
@task(pre=[tests])

View File

@ -4,7 +4,7 @@
<ProjectVersion>18.8</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">GUI</Config>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Console</AppType>

View File

@ -81,6 +81,6 @@ begin
except
on E: Exception do
WriteLn(E.ClassName, ': ', E.Message);
end
end;
end.

View File

@ -612,7 +612,7 @@ procedure TTestServerController.TestObjectDict;
var
lDict: IMVCObjectDictionary;
begin
lDict := ObjectDict(false)
lDict := ObjectDict(True)
.Add('ncUpperCase_List', GetDataSet, nil, dstAllRecords, ncUpperCase)
.Add('ncLowerCase_List', GetDataSet, nil, dstAllRecords, ncLowerCase)
.Add('ncCamelCase_List', GetDataSet, nil, dstAllRecords, ncCamelCase)