Skip to content

Commit

Permalink
Fixed JWT Tests (unified tokens used across JOSE and mORMot-JWT after…
Browse files Browse the repository at this point in the history
… applying a fix to JOSE.

Removed some warnings.
Switched off duplicate constructor will be inaccessible warning.
  • Loading branch information
andrea-magni committed May 28, 2019
1 parent 2fc2a1b commit 868fe99
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
2 changes: 2 additions & 0 deletions tests/MARSTestsProject.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<SanitizedProjectName>MARSTestsProject</SanitizedProjectName>
<VerInfo_Locale>1040</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<DCC_DUPLICATE_CTOR_DTOR>false</DCC_DUPLICATE_CTOR_DTOR>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
<DCC_UsePackage>DBXSqliteDriver;DBXInterBaseDriver;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;fmx;RadiantShapesFmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;iot;bindengine;DataSnapClient;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;ibmonitor;FMXTee;DbxCommonDriver;ibxpress;xmlrtl;DataSnapNativeClient;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;CustomIPTransport;dcliot;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage)</DCC_UsePackage>
Expand Down Expand Up @@ -189,6 +190,7 @@
<Excluded_Packages Name="$(BDSBIN)\DataExplorerDBXPluginEnt260.bpl">DBExpress Enterprise Data Explorer Integration</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k260.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp260.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="C:\Program Files (x86)\Raize\CS5\Bin\CodeSiteExpressPkg_Design260.bpl">CodeSite Express 5.3.3</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="3">
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests.FireDAC.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface
uses
Classes, SysUtils, Rtti, Types
, DUnitX.TestFramework
, FireDAC.Comp.Client, FireDAC.Comp.DataSet, FireDAC.VCLUI.Wait, FireDAC.Phys.SQLite
, FireDAC.Stan.Param, FireDAC.Comp.Client, FireDAC.Comp.DataSet, FireDAC.VCLUI.Wait, FireDAC.Phys.SQLite
, MARS.Core.MediaType
, MARS.Core.MessageBodyReader, MARS.Core.MessageBodyWriter
, MARS.Core.MessageBodyReaders, MARS.Core.MessageBodyWriters
Expand Down
20 changes: 4 additions & 16 deletions tests/Tests.JWT.pas
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ TMARSJWT<T: TMARSToken> = class(TObject)
end;

[TestFixture('JWT.mORMotJWT')]
TMARSmORMotJWT = class(TMARSJWT<TMARSmORMotJWTToken>)
protected
function GetTokenForVerifyOne: string; override;
end;
TMARSmORMotJWT = class(TMARSJWT<TMARSmORMotJWTToken>);

[TestFixture('JWT.JOSEJWT')]
TMARSJOSEJWT = class(TMARSJWT<TMARSJOSEJWTToken>);
Expand Down Expand Up @@ -145,9 +142,9 @@ procedure TMARSJWT<T>.Duration5secs;
function TMARSJWT<T>.GetTokenForVerifyOne: string;
begin
// beware: will expire one million days after Nov 15th, 2017 that is somewhere around Thu, 13 Oct 4755 :-D
Result := 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9'
+'.eyJkdXJhdGlvbiI6MTAwMDAwMCwiUm9sZXMiOiJzdGFuZGFyZCIsImlhdCI6MTUxMDczOTg0OCwiZXhwIjo4NzkxMDczNjI0OCwiQ2xhaW0yIjoxMjMsIlVzZXJOYW1lIjoiQW5kcmVhMSIsIkxBTkdVQUdFX0lEIjoxLCJpc3MiOiJNQVJTLUN1cmlvc2l0eSIsIkNsYWltMSI6IlByaW1vIn0='
+'.OacKD-duGSLeQA21eEzPYlRaIKX7fCWs54GyVpbHC0E=';
Result := 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.'
+ 'eyJkdXJhdGlvbiI6MTAwMDAwMCwiUm9sZXMiOiJzdGFuZGFyZCIsImlhdCI6MTUxMDczOTg0OCwiZXhwIjo4NzkxMDczNjI0OCwiQ2xhaW0yIjoxMjMsIlVzZXJOYW1lIjoiQW5kcmVhMSIsIkxBTkdVQUdFX0lEIjoxLCJpc3MiOiJNQVJTLUN1cmlvc2l0eSIsIkNsYWltMSI6IlByaW1vIn0.'
+ '2DAhF5DWfTCPK13EYSkdlT2LRUA9kmHJcO9v-Gs0x6E';
end;

procedure TMARSJWT<T>.VerifyOne;
Expand Down Expand Up @@ -176,15 +173,6 @@ procedure TMARSJWT<T>.VerifyOne;
end;
end;

{ TMARSmORMotJWT }

function TMARSmORMotJWT.GetTokenForVerifyOne: string;
begin
Result := 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9'
+'.eyJkdXJhdGlvbiI6MTAwMDAwMCwiUm9sZXMiOiJzdGFuZGFyZCIsImlhdCI6MTUxMDc0MTM3MSwiZXhwIjoyMDExMzk1NDUxLCJDbGFpbTIiOjEyMywiVXNlck5hbWUiOiJBbmRyZWExIiwiTEFOR1VBR0VfSUQiOjEsImlzcyI6Ik1BUlMtQ3VyaW9zaXR5IiwiQ2xhaW0xIjoiUHJpbW8ifQ'
+'.k-p3NEEBWXYlf4ilaZn8fE3ufxN29ezMPg8k_HTQg9c';
end;

initialization
TDUnitX.RegisterTestFixture(TMARSmORMotJWT);
TDUnitX.RegisterTestFixture(TMARSJOSEJWT);
Expand Down
4 changes: 2 additions & 2 deletions tests/Tests.MessageBodyWriters.pas
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ TMARSArrayOfRecordWriterTest = class(TObject)
implementation

uses
DateUtils, Rtti
, MARS.Core.JSON
DateUtils, Rtti, Generics.Collections
, System.JSON, MARS.Core.JSON
, Tests.Records.Types
;

Expand Down

0 comments on commit 868fe99

Please sign in to comment.