mORMot and Open Source friends
Check-in [fd8aba6477]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{2724} added an explicit test for TSQLRest.MainFieldIDs
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: fd8aba64777966d5f9ee6fc7b8f2058e4ed7f928
User & Date: ab 2016-06-08 18:56:58
Context
2016-06-09
15:33
additional HTTP server events (not finished yet) check-in: 47ef598245 user: pavel.mash tags: HTTPServerEvents
15:21
{2725} ensure ODBCInstalledDriversList() would use OpenKeyReadOnly instead of OpenKey - seems to work better e.g. in Windows 10 check-in: e31f89e2f8 user: ab tags: trunk
11:05
merge with trunk check-in: 47c5b66003 user: pavel.mash tags: WinWebSocket
2016-06-08
18:56
{2724} added an explicit test for TSQLRest.MainFieldIDs check-in: fd8aba6477 user: ab tags: trunk
18:55
{2723} fixed SetVariantByValue() to convert any string value into RawUTF8 and handle any indirect string types (used e.g. when using pseudo-functions via late binding of TDocVariant) check-in: 609bcf28b0 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SynSelfTests.pas.

13193
13194
13195
13196
13197
13198
13199
13200

13201
13202
13203
13204




13205
13206
13207
13208
13209
13210
13211
    CheckMatchAny(Ask('Add','1,2'),['[3]','{"Result":3}'],true,(1 in Expected),msg);
    CheckMatchAny(Ask('Multiply','2,3'),['[6]','{"Result":6}'],true,(2 in Expected),msg);
    CheckMatchAny(Ask('Subtract','23,20'),['[3]','{"Result":3}'],true,(3 in Expected),msg);
    CheckMatchAny(Ask('ToText','777,"abc"'),['["777"]','{"Result":"777"}'],true,(4 in Expected),msg);
    CheckMatchAny(Ask('ToTextFunc','777'),['["777"]','{"Result":"777"}'],true,(5 in Expected),msg);
  end;
var S: TServiceFactoryServer;
    GroupID: integer;

begin
  fClient.ServicesRouting := TSQLRestRoutingJSON_RPC;
  fClient.Server.ServicesRouting := TSQLRestRoutingJSON_RPC;
  GroupID := fClient.MainFieldID(TSQLAuthGroup,'User');




  S := fClient.Server.Services['Calculator'] as TServiceFactoryServer;
  Test([1,2,3,4,5],'by default, all methods are allowed');
  S.AllowAll;
  Test([1,2,3,4,5],'AllowAll should change nothing');
  S.DenyAll;
  Test([],'DenyAll will reset all settings');
  S.AllowAll;






|
>




>
>
>
>







13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
    CheckMatchAny(Ask('Add','1,2'),['[3]','{"Result":3}'],true,(1 in Expected),msg);
    CheckMatchAny(Ask('Multiply','2,3'),['[6]','{"Result":6}'],true,(2 in Expected),msg);
    CheckMatchAny(Ask('Subtract','23,20'),['[3]','{"Result":3}'],true,(3 in Expected),msg);
    CheckMatchAny(Ask('ToText','777,"abc"'),['["777"]','{"Result":"777"}'],true,(4 in Expected),msg);
    CheckMatchAny(Ask('ToTextFunc','777'),['["777"]','{"Result":"777"}'],true,(5 in Expected),msg);
  end;
var S: TServiceFactoryServer;
    GroupID: TID;
    g: TIDDynArray;
begin
  fClient.ServicesRouting := TSQLRestRoutingJSON_RPC;
  fClient.Server.ServicesRouting := TSQLRestRoutingJSON_RPC;
  GroupID := fClient.MainFieldID(TSQLAuthGroup,'User');
  Check(GroupID<>0);
  Check(fClient.MainFieldIDs(TSQLAuthGroup,['User','Admin'],g));
  Check(length(g)=2);
  Check((g[0]=GroupID) or (g[1]=GroupID));
  S := fClient.Server.Services['Calculator'] as TServiceFactoryServer;
  Test([1,2,3,4,5],'by default, all methods are allowed');
  S.AllowAll;
  Test([1,2,3,4,5],'AllowAll should change nothing');
  S.DenyAll;
  Test([],'DenyAll will reset all settings');
  S.AllowAll;

Changes to SynopseCommit.inc.

1
'1.18.2723'
|
1
'1.18.2724'