Skip to content

Commit

Permalink
Small fix for relative path and documentroot in staticfilemiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed May 2, 2020
1 parent b642900 commit 6c96a6e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 34 deletions.
5 changes: 2 additions & 3 deletions sources/MVCFramework.Middleware.StaticFiles.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
56 changes: 28 additions & 28 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion unittests/general/Several/DMVCFrameworkTests.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion unittests/general/TestServer/TestServer.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ begin
except
on E: Exception do
WriteLn(E.ClassName, ': ', E.Message);
end
end;

end.
2 changes: 1 addition & 1 deletion unittests/general/TestServer/TestServerControllerU.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6c96a6e

Please # to comment.