From edcf16e19122c89a9e05c3d4f507ef92a8dd4aab Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Thu, 15 Oct 2020 16:55:26 +0100 Subject: [PATCH 01/15] Use fresh content streams for successive requests Fixes #32. Implementations of `IWebMockResponseBodySource` now return new streams on calling `GetContentStream`. The content streams are freed by the Indy HTTP server after completion. --- Source/Delphi.WebMock.ResponseContentFile.pas | 6 ++- .../Delphi.WebMock.ResponseContentString.pas | 6 +-- ...Delphi.WebMock.ResponsesWithBody.Tests.pas | 38 +++++++++++++++++++ Tests/Fixtures/Response.json | 4 +- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/Source/Delphi.WebMock.ResponseContentFile.pas b/Source/Delphi.WebMock.ResponseContentFile.pas index 1dd952d..44d4a93 100644 --- a/Source/Delphi.WebMock.ResponseContentFile.pas +++ b/Source/Delphi.WebMock.ResponseContentFile.pas @@ -78,8 +78,12 @@ constructor TWebMockResponseContentFile.Create(const AFileName: string; const AC end; function TWebMockResponseContentFile.GetContentStream: TStream; +var + LContentStream: TMemoryStream; begin - Result := FContentStream; + LContentStream := TMemoryStream.Create; + LContentStream.CopyFrom(FContentStream, 0); + Result := LContentStream; end; function TWebMockResponseContentFile.GetContentType: string; diff --git a/Source/Delphi.WebMock.ResponseContentString.pas b/Source/Delphi.WebMock.ResponseContentString.pas index bdb983d..1459075 100644 --- a/Source/Delphi.WebMock.ResponseContentString.pas +++ b/Source/Delphi.WebMock.ResponseContentString.pas @@ -33,7 +33,6 @@ interface TWebMockResponseContentString = class(TInterfacedObject, IWebMockResponseBodySource) private - FContentStream: TStream; FContentString: string; FContentType: string; procedure SetContentType(const Value: string); @@ -72,10 +71,7 @@ procedure TWebMockResponseContentString.SetContentType(const Value: string); function TWebMockResponseContentString.GetContentStream: TStream; begin - if not Assigned(FContentStream) then - FContentStream := TStringStream.Create(ContentString); - - Result := FContentStream; + Result := TStringStream.Create(ContentString); end; function TWebMockResponseContentString.GetContentString: string; diff --git a/Tests/Features/Delphi.WebMock.ResponsesWithBody.Tests.pas b/Tests/Features/Delphi.WebMock.ResponsesWithBody.Tests.pas index 6a2167a..1433460 100644 --- a/Tests/Features/Delphi.WebMock.ResponsesWithBody.Tests.pas +++ b/Tests/Features/Delphi.WebMock.ResponsesWithBody.Tests.pas @@ -53,9 +53,13 @@ TWebMockResponsesWithBodyTests = class(TObject) [Test] procedure Response_WhenWithBodyIsString_ReturnsUTF8CharSet; [Test] + procedure Response_WhenWithBodyIsStringOnMultipleCalls_Succeeds; + [Test] procedure Response_WhenWithBodyFileWithoutContentType_SetsContentTypeToInferedType; [Test] procedure Response_WhenWithBodyFileWithContentType_SetsContentType; + [Test] + procedure Response_WhenWithBodyFileOnMultipleCalls_Succeeds; end; implementation @@ -67,6 +71,23 @@ implementation System.Net.HttpClient, TestHelpers; +procedure TWebMockResponsesWithBodyTests.Response_WhenWithBodyFileOnMultipleCalls_Succeeds; +var + LExpected: string; + LResponse: IHTTPResponse; +begin + LExpected := '{ "key": "value" }'#10; + WebMock.StubRequest('GET', '/json').ToRespond.WithBodyFile(FixturePath('Response.json')); + + // First request + LResponse := WebClient.Get(WebMock.URLFor('json')); + Assert.AreEqual(LExpected, LResponse.ContentAsString); + + // Second request + LResponse := WebClient.Get(WebMock.URLFor('json')); + Assert.AreEqual(LExpected, LResponse.ContentAsString); +end; + procedure TWebMockResponsesWithBodyTests.Response_WhenWithBodyFileWithContentType_SetsContentType; var LExpected: string; @@ -128,6 +149,23 @@ procedure TWebMockResponsesWithBodyTests.Response_WhenWithBodyIsAString_ReturnsS Assert.AreEqual(LExpectedContent, LContentText); end; +procedure TWebMockResponsesWithBodyTests.Response_WhenWithBodyIsStringOnMultipleCalls_Succeeds; +var + LContent: string; + LResponse: IHTTPResponse; +begin + LContent := 'Some text...'; + WebMock.StubRequest('GET', '/text').ToRespond.WithBody(LContent); + + // First request + LResponse := WebClient.Get(WebMock.URLFor('text')); + Assert.EndsWith(LContent, LResponse.ContentAsString); + + // Second request + LResponse := WebClient.Get(WebMock.URLFor('text')); + Assert.EndsWith(LContent, LResponse.ContentAsString); +end; + procedure TWebMockResponsesWithBodyTests.Response_WhenWithBodyIsString_ReturnsUTF8CharSet; var LResponse: IHTTPResponse; diff --git a/Tests/Fixtures/Response.json b/Tests/Fixtures/Response.json index 7a9e864..7ba1b79 100644 --- a/Tests/Fixtures/Response.json +++ b/Tests/Fixtures/Response.json @@ -1,3 +1 @@ -{ - "key": "value" -} +{ "key": "value" } From ce52f221670ed1f0ec1038fba4f86cc585d00b5e Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 16 Oct 2020 11:13:44 +0100 Subject: [PATCH 02/15] Allow any authorization header values for stubs Fixes #34. Removing authorization checks for request stubs allows testing of requests with an authorization header without interference from the default authorization behaviour. This is useful for testing custom authorization schemes. --- Source/Delphi.WebMock.pas | 10 ++++++++++ .../Delphi.WebMock.Responses.Tests.pas | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/Source/Delphi.WebMock.pas b/Source/Delphi.WebMock.pas index 276daec..53e86bb 100644 --- a/Source/Delphi.WebMock.pas +++ b/Source/Delphi.WebMock.pas @@ -53,6 +53,9 @@ TWebMock = class(TObject) procedure StartServer(const APort: TWebWockPort); procedure OnServerRequest(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo); + procedure AllowAnyAuth(AContext: TIdContext; + const AAuthType, AAuthData: String; var VUsername, VPassword: String; + var VHandled: Boolean); function GetRequestStub(ARequestInfo: IWebMockHTTPRequest) : IWebMockRequestStub; procedure RespondWith(AResponse: TWebMockResponse; AResponseInfo: TIdHTTPResponseInfo); @@ -98,6 +101,12 @@ implementation { TWebMock } +procedure TWebMock.AllowAnyAuth(AContext: TIdContext; const AAuthType, + AAuthData: String; var VUsername, VPassword: String; var VHandled: Boolean); +begin + VHandled := True; +end; + function TWebMock.Assert: TWebMockAssertion; begin Result := TWebMockAssertion.Create(History); @@ -159,6 +168,7 @@ procedure TWebMock.InitializeServer(const APort: TWebWockPort); Server.ServerSoftware := 'Delphi WebMocks'; Server.OnCommandGet := OnServerRequest; Server.OnCommandOther := OnServerRequest; + Server.OnParseAuthentication := AllowAnyAuth; StartServer(APort); end; diff --git a/Tests/Features/Delphi.WebMock.Responses.Tests.pas b/Tests/Features/Delphi.WebMock.Responses.Tests.pas index 4959cc3..ed58df8 100644 --- a/Tests/Features/Delphi.WebMock.Responses.Tests.pas +++ b/Tests/Features/Delphi.WebMock.Responses.Tests.pas @@ -54,6 +54,8 @@ TWebMockResponsesTests = class(TObject) procedure Response_WhenToRespondSetsStatus_ReturnsSpecifiedStatusText; [Test] procedure Response_WhenToRespondSetsCustomStatus_ReturnsSpecifiedStatusText; + [Test] + procedure Response_WhenRequestAuthorizationHeaderIsNotBasic_ItRespondsWithoutError; end; implementation @@ -62,9 +64,24 @@ implementation uses Delphi.WebMock.ResponseStatus, - System.Net.HttpClient, System.StrUtils, + System.Net.HttpClient, System.Net.URLClient, System.StrUtils, TestHelpers; +procedure TWebMockResponsesTests.Response_WhenRequestAuthorizationHeaderIsNotBasic_ItRespondsWithoutError; +var + LHeaders: TNetHeaders; + LResponse: IHTTPResponse; +begin + WebMock.StubRequest('*', '*'); + + LHeaders := TNetHeaders.Create( + TNetHeader.Create('Authorization', 'NonStandardAuthScheme') + ); + LResponse := WebClient.Get(WebMock.BaseURL, nil, LHeaders); + + Assert.AreEqual(200, LResponse.StatusCode); +end; + procedure TWebMockResponsesTests.Response_WhenRequestIsNotStubbed_ReturnsNotImplemented; var LResponse: IHTTPResponse; From bb8a132785d6489572cf0cfd0e91a52e7085a30b Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Wed, 18 Nov 2020 18:42:59 +0000 Subject: [PATCH 03/15] Remove `Delphi.` unit prefix Resolves #36. People using this library are already using Delphi so there is no point making people write the name prefix repeatedly. WARNING: This is a breaking change. Existing projects will need to remove the `Delphi.` from their WebMock `uses`. --- README.md | 6 +- ...ck.Assertion.pas => WebMock.Assertion.pas} | 12 +- ...ub.pas => WebMock.Dynamic.RequestStub.pas} | 8 +- ...Messages.pas => WebMock.HTTP.Messages.pas} | 4 +- ...P.Request.pas => WebMock.HTTP.Request.pas} | 8 +- ...er.pas => WebMock.HTTP.RequestMatcher.pas} | 14 +-- ...equestStub.pas => WebMock.RequestStub.pas} | 8 +- ...Mock.Response.pas => WebMock.Response.pas} | 12 +- ...rce.pas => WebMock.ResponseBodySource.pas} | 4 +- ...le.pas => WebMock.ResponseContentFile.pas} | 6 +- ....pas => WebMock.ResponseContentString.pas} | 6 +- ...eStatus.pas => WebMock.ResponseStatus.pas} | 4 +- ...tub.pas => WebMock.Static.RequestStub.pas} | 15 ++- ...tcher.pas => WebMock.StringAnyMatcher.pas} | 6 +- ...gMatcher.pas => WebMock.StringMatcher.pas} | 4 +- ...her.pas => WebMock.StringRegExMatcher.pas} | 8 +- ....pas => WebMock.StringWildcardMatcher.pas} | 6 +- Source/{Delphi.WebMock.pas => WebMock.pas} | 17 ++- Tests/Delphi.WebMocks.Tests.dpr | 104 ------------------ ...Tests.pas => WebMock.Assertions.Tests.pas} | 12 +- ....pas => WebMock.DynamicMatching.Tests.pas} | 10 +- ...ry.Tests.pas => WebMock.History.Tests.pas} | 12 +- ...g.Tests.pas => WebMock.Matching.Tests.pas} | 14 +-- ...sts.pas => WebMock.MatchingBody.Tests.pas} | 8 +- ....Tests.pas => WebMock.Responses.Tests.pas} | 12 +- ...as => WebMock.ResponsesWithBody.Tests.pas} | 8 +- ...=> WebMock.ResponsesWithHeaders.Tests.pas} | 8 +- Tests/Mock.Indy.HTTPRequestInfo.pas | 2 +- Tests/TestHelpers.pas | 2 +- ....Tests.pas => WebMock.Assertion.Tests.pas} | 14 +-- ... => WebMock.Dynamic.RequestStub.Tests.pas} | 13 +-- ...sts.pas => WebMock.HTTP.Request.Tests.pas} | 6 +- ... => WebMock.HTTP.RequestMatcher.Tests.pas} | 13 +-- ...e.Tests.pas => WebMock.Response.Tests.pas} | 10 +- ... => WebMock.ResponseContentFile.Tests.pas} | 6 +- ...> WebMock.ResponseContentString.Tests.pas} | 6 +- ...s.pas => WebMock.ResponseStatus.Tests.pas} | 6 +- ...s => WebMock.Static.RequestStub.Tests.pas} | 15 ++- ...pas => WebMock.StringAnyMatcher.Tests.pas} | 8 +- ...s => WebMock.StringRegExMatcher.Tests.pas} | 12 +- ...> WebMock.StringWildcardMatcher.Tests.pas} | 10 +- ...hi.WebMock.Tests.pas => WebMock.Tests.pas} | 14 +-- Tests/WebMocks.Tests.dpr | 104 ++++++++++++++++++ ...Mocks.Tests.dproj => WebMocks.Tests.dproj} | 86 +++++++-------- Tests/WebMocks.Tests.res | Bin 0 -> 109732 bytes ...i WebMocks.groupproj => WebMocks.groupproj | 20 ++-- 46 files changed, 339 insertions(+), 344 deletions(-) rename Source/{Delphi.WebMock.Assertion.pas => WebMock.Assertion.pas} (95%) rename Source/{Delphi.WebMock.Dynamic.RequestStub.pas => WebMock.Dynamic.RequestStub.pas} (93%) rename Source/{Delphi.WebMock.HTTP.Messages.pas => WebMock.HTTP.Messages.pas} (96%) rename Source/{Delphi.WebMock.HTTP.Request.pas => WebMock.HTTP.Request.pas} (96%) rename Source/{Delphi.WebMock.HTTP.RequestMatcher.pas => WebMock.HTTP.RequestMatcher.pas} (93%) rename Source/{Delphi.WebMock.RequestStub.pas => WebMock.RequestStub.pas} (92%) rename Source/{Delphi.WebMock.Response.pas => WebMock.Response.pas} (93%) rename Source/{Delphi.WebMock.ResponseBodySource.pas => WebMock.ResponseBodySource.pas} (94%) rename Source/{Delphi.WebMock.ResponseContentFile.pas => WebMock.ResponseContentFile.pas} (95%) rename Source/{Delphi.WebMock.ResponseContentString.pas => WebMock.ResponseContentString.pas} (94%) rename Source/{Delphi.WebMock.ResponseStatus.pas => WebMock.ResponseStatus.pas} (98%) rename Source/{Delphi.WebMock.Static.RequestStub.pas => WebMock.Static.RequestStub.pas} (93%) rename Source/{Delphi.WebMock.StringAnyMatcher.pas => WebMock.StringAnyMatcher.pas} (93%) rename Source/{Delphi.WebMock.StringMatcher.pas => WebMock.StringMatcher.pas} (94%) rename Source/{Delphi.WebMock.StringRegExMatcher.pas => WebMock.StringRegExMatcher.pas} (93%) rename Source/{Delphi.WebMock.StringWildcardMatcher.pas => WebMock.StringWildcardMatcher.pas} (94%) rename Source/{Delphi.WebMock.pas => WebMock.pas} (95%) delete mode 100644 Tests/Delphi.WebMocks.Tests.dpr rename Tests/Features/{Delphi.WebMock.Assertions.Tests.pas => WebMock.Assertions.Tests.pas} (98%) rename Tests/Features/{Delphi.WebMock.DynamicMatching.Tests.pas => WebMock.DynamicMatching.Tests.pas} (95%) rename Tests/Features/{Delphi.WebMock.History.Tests.pas => WebMock.History.Tests.pas} (94%) rename Tests/Features/{Delphi.WebMock.Matching.Tests.pas => WebMock.Matching.Tests.pas} (97%) rename Tests/Features/{Delphi.WebMock.MatchingBody.Tests.pas => WebMock.MatchingBody.Tests.pas} (96%) rename Tests/Features/{Delphi.WebMock.Responses.Tests.pas => WebMock.Responses.Tests.pas} (96%) rename Tests/Features/{Delphi.WebMock.ResponsesWithBody.Tests.pas => WebMock.ResponsesWithBody.Tests.pas} (97%) rename Tests/Features/{Delphi.WebMock.ResponsesWithHeaders.Tests.pas => WebMock.ResponsesWithHeaders.Tests.pas} (96%) rename Tests/{Delphi.WebMock.Assertion.Tests.pas => WebMock.Assertion.Tests.pas} (96%) rename Tests/{Delphi.WebMock.Dynamic.RequestStub.Tests.pas => WebMock.Dynamic.RequestStub.Tests.pas} (94%) rename Tests/{Delphi.WebMock.HTTP.Request.Tests.pas => WebMock.HTTP.Request.Tests.pas} (97%) rename Tests/{Delphi.WebMock.HTTP.RequestMatcher.Tests.pas => WebMock.HTTP.RequestMatcher.Tests.pas} (95%) rename Tests/{Delphi.WebMock.Response.Tests.pas => WebMock.Response.Tests.pas} (97%) rename Tests/{Delphi.WebMock.ResponseContentFile.Tests.pas => WebMock.ResponseContentFile.Tests.pas} (96%) rename Tests/{Delphi.WebMock.ResponseContentString.Tests.pas => WebMock.ResponseContentString.Tests.pas} (96%) rename Tests/{Delphi.WebMock.ResponseStatus.Tests.pas => WebMock.ResponseStatus.Tests.pas} (99%) rename Tests/{Delphi.WebMock.Static.RequestStub.Tests.pas => WebMock.Static.RequestStub.Tests.pas} (94%) rename Tests/{Delphi.WebMock.StringAnyMatcher.Tests.pas => WebMock.StringAnyMatcher.Tests.pas} (93%) rename Tests/{Delphi.WebMock.StringRegExMatcher.Tests.pas => WebMock.StringRegExMatcher.Tests.pas} (93%) rename Tests/{Delphi.WebMock.StringWildcardMatcher.Tests.pas => WebMock.StringWildcardMatcher.Tests.pas} (95%) rename Tests/{Delphi.WebMock.Tests.pas => WebMock.Tests.pas} (95%) create mode 100644 Tests/WebMocks.Tests.dpr rename Tests/{Delphi.WebMocks.Tests.dproj => WebMocks.Tests.dproj} (94%) create mode 100644 Tests/WebMocks.Tests.res rename Delphi WebMocks.groupproj => WebMocks.groupproj (57%) diff --git a/README.md b/README.md index 1d34188..1f6488e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ WebMocks should now be listed in ## Setup In your test unit file a couple of simple steps are required. -1. Add `Delphi.WebMock` to your interface `uses`. +1. Add `WebMock` to your interface `uses`. 2. In your `TestFixture` class use `Setup` and `TearDown` to create/destroy an instance of `TWebMock`. @@ -46,8 +46,8 @@ interface uses DUnitX.TestFramework, - Delphi.WebMock, - MyTestObjectUnit; + MyTestObjectUnit, + WebMock; type TMyTestObjectTests = class(TObject) diff --git a/Source/Delphi.WebMock.Assertion.pas b/Source/WebMock.Assertion.pas similarity index 95% rename from Source/Delphi.WebMock.Assertion.pas rename to Source/WebMock.Assertion.pas index 87663c2..0779aca 100644 --- a/Source/Delphi.WebMock.Assertion.pas +++ b/Source/WebMock.Assertion.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.Assertion; +unit WebMock.Assertion; interface uses - Delphi.WebMock.HTTP.Messages, Delphi.WebMock.HTTP.RequestMatcher, DUnitX.TestFramework, - System.Classes, System.Generics.Collections, System.RegularExpressions; + System.Classes, System.Generics.Collections, System.RegularExpressions, + WebMock.HTTP.Messages, WebMock.HTTP.RequestMatcher; type TWebMockAssertion = class(TObject) @@ -63,8 +63,8 @@ implementation { TWebMockAssertion } uses - Delphi.WebMock.StringRegExMatcher, Delphi.WebMock.StringWildcardMatcher, - System.SysUtils; + System.SysUtils, + WebMock.StringRegExMatcher, WebMock.StringWildcardMatcher; constructor TWebMockAssertion.Create(AHistory: TList); begin diff --git a/Source/Delphi.WebMock.Dynamic.RequestStub.pas b/Source/WebMock.Dynamic.RequestStub.pas similarity index 93% rename from Source/Delphi.WebMock.Dynamic.RequestStub.pas rename to Source/WebMock.Dynamic.RequestStub.pas index 84b98c9..bb5e6cf 100644 --- a/Source/Delphi.WebMock.Dynamic.RequestStub.pas +++ b/Source/WebMock.Dynamic.RequestStub.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.Dynamic.RequestStub; +unit WebMock.Dynamic.RequestStub; interface uses - Delphi.WebMock.HTTP.Messages, Delphi.WebMock.RequestStub, - Delphi.WebMock.Response, Delphi.WebMock.ResponseStatus; + WebMock.HTTP.Messages, WebMock.RequestStub, WebMock.Response, + WebMock.ResponseStatus; type TWebMockDynamicRequestMatcher = reference to function( diff --git a/Source/Delphi.WebMock.HTTP.Messages.pas b/Source/WebMock.HTTP.Messages.pas similarity index 96% rename from Source/Delphi.WebMock.HTTP.Messages.pas rename to Source/WebMock.HTTP.Messages.pas index d4c21db..6963109 100644 --- a/Source/Delphi.WebMock.HTTP.Messages.pas +++ b/Source/WebMock.HTTP.Messages.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,7 +23,7 @@ { } {******************************************************************************} -unit Delphi.WebMock.HTTP.Messages; +unit WebMock.HTTP.Messages; interface diff --git a/Source/Delphi.WebMock.HTTP.Request.pas b/Source/WebMock.HTTP.Request.pas similarity index 96% rename from Source/Delphi.WebMock.HTTP.Request.pas rename to Source/WebMock.HTTP.Request.pas index b5dd461..8724708 100644 --- a/Source/Delphi.WebMock.HTTP.Request.pas +++ b/Source/WebMock.HTTP.Request.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.HTTP.Request; +unit WebMock.HTTP.Request; interface uses - Delphi.WebMock.HTTP.Messages, IdCustomHTTPServer, IdHeaderList, - System.Classes; + System.Classes, + WebMock.HTTP.Messages; type TWebMockHTTPRequest = class(TInterfacedObject, IWebMockHTTPRequest) diff --git a/Source/Delphi.WebMock.HTTP.RequestMatcher.pas b/Source/WebMock.HTTP.RequestMatcher.pas similarity index 93% rename from Source/Delphi.WebMock.HTTP.RequestMatcher.pas rename to Source/WebMock.HTTP.RequestMatcher.pas index 239b498..59c8914 100644 --- a/Source/Delphi.WebMock.HTTP.RequestMatcher.pas +++ b/Source/WebMock.HTTP.RequestMatcher.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.HTTP.RequestMatcher; +unit WebMock.HTTP.RequestMatcher; interface uses - Delphi.WebMock.HTTP.Messages, Delphi.WebMock.StringMatcher, IdCustomHTTPServer, IdHeaderList, - System.Classes, System.Generics.Collections, System.RegularExpressions; + System.Classes, System.Generics.Collections, System.RegularExpressions, + WebMock.HTTP.Messages, WebMock.StringMatcher; type TWebMockHTTPRequestMatcher = class(TObject) @@ -60,9 +60,9 @@ implementation { TWebMockHTTPRequestMatcher } uses - Delphi.WebMock.StringWildcardMatcher, Delphi.WebMock.StringAnyMatcher, - Delphi.WebMock.StringRegExMatcher, - System.SysUtils; + System.SysUtils, + WebMock.StringWildcardMatcher, WebMock.StringAnyMatcher, + WebMock.StringRegExMatcher; constructor TWebMockHTTPRequestMatcher.Create(AURI: string; AHTTPMethod: string = 'GET'); diff --git a/Source/Delphi.WebMock.RequestStub.pas b/Source/WebMock.RequestStub.pas similarity index 92% rename from Source/Delphi.WebMock.RequestStub.pas rename to Source/WebMock.RequestStub.pas index 8682c9a..b9e3245 100644 --- a/Source/Delphi.WebMock.RequestStub.pas +++ b/Source/WebMock.RequestStub.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.RequestStub; +unit WebMock.RequestStub; interface uses - Delphi.WebMock.HTTP.Messages, Delphi.WebMock.Response, - System.Classes; + System.Classes, + WebMock.HTTP.Messages, WebMock.Response; type IWebMockRequestStub = interface(IInterface) diff --git a/Source/Delphi.WebMock.Response.pas b/Source/WebMock.Response.pas similarity index 93% rename from Source/Delphi.WebMock.Response.pas rename to Source/WebMock.Response.pas index 7e6232a..2815b71 100644 --- a/Source/Delphi.WebMock.Response.pas +++ b/Source/WebMock.Response.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.Response; +unit WebMock.Response; interface uses - Delphi.WebMock.ResponseBodySource, Delphi.WebMock.ResponseStatus, - System.Classes; + System.Classes, + WebMock.ResponseBodySource, WebMock.ResponseStatus; type TWebMockResponse = class(TObject) @@ -57,8 +57,8 @@ implementation { TWebMockResponse } uses - Delphi.WebMock.ResponseContentFile, Delphi.WebMock.ResponseContentString, - System.SysUtils; + System.SysUtils, + WebMock.ResponseContentFile, WebMock.ResponseContentString; constructor TWebMockResponse.Create(const AStatus : TWebMockResponseStatus = nil); diff --git a/Source/Delphi.WebMock.ResponseBodySource.pas b/Source/WebMock.ResponseBodySource.pas similarity index 94% rename from Source/Delphi.WebMock.ResponseBodySource.pas rename to Source/WebMock.ResponseBodySource.pas index f3f703f..4935119 100644 --- a/Source/Delphi.WebMock.ResponseBodySource.pas +++ b/Source/WebMock.ResponseBodySource.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,7 +23,7 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponseBodySource; +unit WebMock.ResponseBodySource; interface diff --git a/Source/Delphi.WebMock.ResponseContentFile.pas b/Source/WebMock.ResponseContentFile.pas similarity index 95% rename from Source/Delphi.WebMock.ResponseContentFile.pas rename to Source/WebMock.ResponseContentFile.pas index 44d4a93..15283ed 100644 --- a/Source/Delphi.WebMock.ResponseContentFile.pas +++ b/Source/WebMock.ResponseContentFile.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,11 +23,11 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponseContentFile; +unit WebMock.ResponseContentFile; interface -uses Delphi.WebMock.ResponseBodySource, IdCustomHTTPServer, System.Classes; +uses IdCustomHTTPServer, System.Classes, WebMock.ResponseBodySource; type TWebMockResponseContentFile = class(TInterfacedObject, IWebMockResponseBodySource) diff --git a/Source/Delphi.WebMock.ResponseContentString.pas b/Source/WebMock.ResponseContentString.pas similarity index 94% rename from Source/Delphi.WebMock.ResponseContentString.pas rename to Source/WebMock.ResponseContentString.pas index 1459075..915a973 100644 --- a/Source/Delphi.WebMock.ResponseContentString.pas +++ b/Source/WebMock.ResponseContentString.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,11 +23,11 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponseContentString; +unit WebMock.ResponseContentString; interface -uses Delphi.WebMock.ResponseBodySource, System.Classes; +uses System.Classes, WebMock.ResponseBodySource; type TWebMockResponseContentString = class(TInterfacedObject, diff --git a/Source/Delphi.WebMock.ResponseStatus.pas b/Source/WebMock.ResponseStatus.pas similarity index 98% rename from Source/Delphi.WebMock.ResponseStatus.pas rename to Source/WebMock.ResponseStatus.pas index ceeceeb..950993f 100644 --- a/Source/Delphi.WebMock.ResponseStatus.pas +++ b/Source/WebMock.ResponseStatus.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,7 +23,7 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponseStatus; +unit WebMock.ResponseStatus; {$WARN DUPLICATE_CTOR_DTOR OFF} diff --git a/Source/Delphi.WebMock.Static.RequestStub.pas b/Source/WebMock.Static.RequestStub.pas similarity index 93% rename from Source/Delphi.WebMock.Static.RequestStub.pas rename to Source/WebMock.Static.RequestStub.pas index b252123..b06db20 100644 --- a/Source/Delphi.WebMock.Static.RequestStub.pas +++ b/Source/WebMock.Static.RequestStub.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,16 +23,15 @@ { } {******************************************************************************} -unit Delphi.WebMock.Static.RequestStub; +unit WebMock.Static.RequestStub; interface uses - Delphi.WebMock.HTTP.Messages, Delphi.WebMock.HTTP.RequestMatcher, - Delphi.WebMock.RequestStub, Delphi.WebMock.Response, - Delphi.WebMock.ResponseStatus, IdCustomHTTPServer, - System.Classes, System.Generics.Collections, System.RegularExpressions; + System.Classes, System.Generics.Collections, System.RegularExpressions, + WebMock.HTTP.Messages, WebMock.HTTP.RequestMatcher, WebMock.RequestStub, + WebMock.Response, WebMock.ResponseStatus; type TWebMockStaticRequestStub = class(TInterfacedObject, IWebMockRequestStub) @@ -64,8 +63,8 @@ TWebMockStaticRequestStub = class(TInterfacedObject, IWebMockRequestStub) implementation uses - Delphi.WebMock.StringWildcardMatcher, Delphi.WebMock.StringRegExMatcher, - System.SysUtils; + System.SysUtils, + WebMock.StringWildcardMatcher, WebMock.StringRegExMatcher; { TWebMockRequestStub } diff --git a/Source/Delphi.WebMock.StringAnyMatcher.pas b/Source/WebMock.StringAnyMatcher.pas similarity index 93% rename from Source/Delphi.WebMock.StringAnyMatcher.pas rename to Source/WebMock.StringAnyMatcher.pas index 51f000a..79d5889 100644 --- a/Source/Delphi.WebMock.StringAnyMatcher.pas +++ b/Source/WebMock.StringAnyMatcher.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,12 +23,12 @@ { } {******************************************************************************} -unit Delphi.WebMock.StringAnyMatcher; +unit WebMock.StringAnyMatcher; interface uses - Delphi.WebMock.StringMatcher; + WebMock.StringMatcher; type TWebMockStringAnyMatcher = class(TInterfacedObject, IStringMatcher) diff --git a/Source/Delphi.WebMock.StringMatcher.pas b/Source/WebMock.StringMatcher.pas similarity index 94% rename from Source/Delphi.WebMock.StringMatcher.pas rename to Source/WebMock.StringMatcher.pas index 6d37a2a..5c8ac7d 100644 --- a/Source/Delphi.WebMock.StringMatcher.pas +++ b/Source/WebMock.StringMatcher.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,7 +23,7 @@ { } {******************************************************************************} -unit Delphi.WebMock.StringMatcher; +unit WebMock.StringMatcher; interface diff --git a/Source/Delphi.WebMock.StringRegExMatcher.pas b/Source/WebMock.StringRegExMatcher.pas similarity index 93% rename from Source/Delphi.WebMock.StringRegExMatcher.pas rename to Source/WebMock.StringRegExMatcher.pas index a09f4d6..e2f5cc3 100644 --- a/Source/Delphi.WebMock.StringRegExMatcher.pas +++ b/Source/WebMock.StringRegExMatcher.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.StringRegExMatcher; +unit WebMock.StringRegExMatcher; interface uses - Delphi.WebMock.StringMatcher, - System.RegularExpressions; + System.RegularExpressions, + WebMock.StringMatcher; type TWebMockStringRegExMatcher = class(TInterfacedObject, IStringMatcher) diff --git a/Source/Delphi.WebMock.StringWildcardMatcher.pas b/Source/WebMock.StringWildcardMatcher.pas similarity index 94% rename from Source/Delphi.WebMock.StringWildcardMatcher.pas rename to Source/WebMock.StringWildcardMatcher.pas index b64bc9f..d256a29 100644 --- a/Source/Delphi.WebMock.StringWildcardMatcher.pas +++ b/Source/WebMock.StringWildcardMatcher.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,12 +23,12 @@ { } {******************************************************************************} -unit Delphi.WebMock.StringWildcardMatcher; +unit WebMock.StringWildcardMatcher; interface uses - Delphi.WebMock.StringMatcher; + WebMock.StringMatcher; type TWebMockStringWildcardMatcher = class(TInterfacedObject, IStringMatcher) diff --git a/Source/Delphi.WebMock.pas b/Source/WebMock.pas similarity index 95% rename from Source/Delphi.WebMock.pas rename to Source/WebMock.pas index 53e86bb..139a533 100644 --- a/Source/Delphi.WebMock.pas +++ b/Source/WebMock.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,18 +23,17 @@ { } {******************************************************************************} -unit Delphi.WebMock; +unit WebMock; interface uses - Delphi.WebMock.Assertion, Delphi.WebMock.HTTP.Messages, - Delphi.WebMock.RequestStub, Delphi.WebMock.Static.RequestStub, - Delphi.WebMock.Dynamic.RequestStub, Delphi.WebMock.Response, - Delphi.WebMock.ResponseBodySource, Delphi.WebMock.ResponseStatus, IdContext, IdCustomHTTPServer, IdGlobal, IdHTTPServer, System.Classes, System.Generics.Collections, System.RegularExpressions, - System.SysUtils; + System.SysUtils, + WebMock.Assertion, WebMock.HTTP.Messages, WebMock.RequestStub, + WebMock.Static.RequestStub, WebMock.Dynamic.RequestStub, WebMock.Response, + WebMock.ResponseBodySource, WebMock.ResponseStatus; type EWebMockError = class(Exception); @@ -92,8 +91,8 @@ TWebMock = class(TObject) implementation uses - Delphi.WebMock.HTTP.Request, - Delphi.WebMock.HTTP.RequestMatcher, + WebMock.HTTP.Request, + WebMock.HTTP.RequestMatcher, IdException, IdHTTP, IdSocketHandle, diff --git a/Tests/Delphi.WebMocks.Tests.dpr b/Tests/Delphi.WebMocks.Tests.dpr deleted file mode 100644 index 31808f9..0000000 --- a/Tests/Delphi.WebMocks.Tests.dpr +++ /dev/null @@ -1,104 +0,0 @@ -program Delphi.WebMocks.Tests; - -{$IFNDEF TESTINSIGHT} -{$APPTYPE CONSOLE} -{$ENDIF}{$STRONGLINKTYPES ON} - -{$WARN DUPLICATE_CTOR_DTOR OFF} - -uses - System.SysUtils, - {$IFDEF TESTINSIGHT} - TestInsight.DUnitX, - {$ENDIF } - DUnitX.Loggers.Console, - DUnitX.Loggers.Xml.NUnit, - DUnitX.TestFramework, - Delphi.WebMock.Tests in 'Delphi.WebMock.Tests.pas', - Delphi.WebMock in '..\Source\Delphi.WebMock.pas', - TestHelpers in 'TestHelpers.pas', - Delphi.WebMock.Static.RequestStub.Tests in 'Delphi.WebMock.Static.RequestStub.Tests.pas', - Delphi.WebMock.Static.RequestStub in '..\Source\Delphi.WebMock.Static.RequestStub.pas', - Delphi.WebMock.HTTP.RequestMatcher.Tests in 'Delphi.WebMock.HTTP.RequestMatcher.Tests.pas', - Delphi.WebMock.HTTP.RequestMatcher in '..\Source\Delphi.WebMock.HTTP.RequestMatcher.pas', - Mock.Indy.HTTPRequestInfo in 'Mock.Indy.HTTPRequestInfo.pas', - Delphi.WebMock.ResponseStatus.Tests in 'Delphi.WebMock.ResponseStatus.Tests.pas', - Delphi.WebMock.ResponseStatus in '..\Source\Delphi.WebMock.ResponseStatus.pas', - Delphi.WebMock.Response.Tests in 'Delphi.WebMock.Response.Tests.pas', - Delphi.WebMock.Response in '..\Source\Delphi.WebMock.Response.pas', - Delphi.WebMock.ResponseContentString.Tests in 'Delphi.WebMock.ResponseContentString.Tests.pas', - Delphi.WebMock.ResponseContentString in '..\Source\Delphi.WebMock.ResponseContentString.pas', - Delphi.WebMock.ResponseBodySource in '..\Source\Delphi.WebMock.ResponseBodySource.pas', - Delphi.WebMock.ResponseContentFile.Tests in 'Delphi.WebMock.ResponseContentFile.Tests.pas', - Delphi.WebMock.ResponseContentFile in '..\Source\Delphi.WebMock.ResponseContentFile.pas', - Delphi.WebMock.Matching.Tests in 'Features\Delphi.WebMock.Matching.Tests.pas', - Delphi.WebMock.StringWildcardMatcher.Tests in 'Delphi.WebMock.StringWildcardMatcher.Tests.pas', - Delphi.WebMock.StringWildcardMatcher in '..\Source\Delphi.WebMock.StringWildcardMatcher.pas', - Delphi.WebMock.StringMatcher in '..\Source\Delphi.WebMock.StringMatcher.pas', - Delphi.WebMock.StringRegExMatcher.Tests in 'Delphi.WebMock.StringRegExMatcher.Tests.pas', - Delphi.WebMock.StringRegExMatcher in '..\Source\Delphi.WebMock.StringRegExMatcher.pas', - Delphi.WebMock.ResponsesWithHeaders.Tests in 'Features\Delphi.WebMock.ResponsesWithHeaders.Tests.pas', - Delphi.WebMock.ResponsesWithBody.Tests in 'Features\Delphi.WebMock.ResponsesWithBody.Tests.pas', - Delphi.WebMock.MatchingBody.Tests in 'Features\Delphi.WebMock.MatchingBody.Tests.pas', - Delphi.WebMock.StringAnyMatcher.Tests in 'Delphi.WebMock.StringAnyMatcher.Tests.pas', - Delphi.WebMock.StringAnyMatcher in '..\Source\Delphi.WebMock.StringAnyMatcher.pas', - Delphi.WebMock.History.Tests in 'Features\Delphi.WebMock.History.Tests.pas', - Delphi.WebMock.HTTP.Messages in '..\Source\Delphi.WebMock.HTTP.Messages.pas', - Delphi.WebMock.HTTP.Request.Tests in 'Delphi.WebMock.HTTP.Request.Tests.pas', - Delphi.WebMock.HTTP.Request in '..\Source\Delphi.WebMock.HTTP.Request.pas', - Delphi.WebMock.Responses.Tests in 'Features\Delphi.WebMock.Responses.Tests.pas', - Delphi.WebMock.Assertions.Tests in 'Features\Delphi.WebMock.Assertions.Tests.pas', - Delphi.WebMock.Assertion in '..\Source\Delphi.WebMock.Assertion.pas', - Delphi.WebMock.Assertion.Tests in 'Delphi.WebMock.Assertion.Tests.pas', - Delphi.WebMock.DynamicMatching.Tests in 'Features\Delphi.WebMock.DynamicMatching.Tests.pas', - Delphi.WebMock.Dynamic.RequestStub.Tests in 'Delphi.WebMock.Dynamic.RequestStub.Tests.pas', - Delphi.WebMock.Dynamic.RequestStub in '..\Source\Delphi.WebMock.Dynamic.RequestStub.pas', - Delphi.WebMock.RequestStub in '..\Source\Delphi.WebMock.RequestStub.pas'; - -var - Runner: ITestRunner; - Results: IRunResults; - Logger: ITestLogger; - NUnitLogger: ITestLogger; - -begin -{$IFDEF TESTINSIGHT} - TestInsight.DUnitX.RunRegisteredTests; - exit; -{$ENDIF} - try - // Check command line options, will exit if invalid - TDUnitX.CheckCommandLine; - // Create the test runner - Runner := TDUnitX.CreateRunner; - // Tell the runner to use RTTI to find Fixtures - Runner.UseRTTI := True; - // tell the runner how we will log things - // Log to the console window - Logger := TDUnitXConsoleLogger.Create(True); - Runner.AddLogger(Logger); - // Generate an NUnit compatible XML File - NUnitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile); - Runner.AddLogger(NUnitLogger); - Runner.FailsOnNoAsserts := False; - // When true, Assertions must be made during tests; - - // Run tests - Results := Runner.Execute; - if not Results.AllPassed then - System.ExitCode := EXIT_ERRORS; - -{$IFNDEF CI} - // We don't want this happening when running under CI. - if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then - begin - System.Write('Done.. press key to quit.'); - System.Readln; - end; -{$ENDIF} - except - on E: Exception do - System.Writeln(E.ClassName, ': ', E.Message); - end; - -end. diff --git a/Tests/Features/Delphi.WebMock.Assertions.Tests.pas b/Tests/Features/WebMock.Assertions.Tests.pas similarity index 98% rename from Tests/Features/Delphi.WebMock.Assertions.Tests.pas rename to Tests/Features/WebMock.Assertions.Tests.pas index eb4bf08..9f0c4f5 100644 --- a/Tests/Features/Delphi.WebMock.Assertions.Tests.pas +++ b/Tests/Features/WebMock.Assertions.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,15 +23,15 @@ { } {******************************************************************************} -unit Delphi.WebMock.Assertions.Tests; +unit WebMock.Assertions.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, System.Classes, - System.SysUtils; + System.SysUtils, + WebMock; type [TestFixture] @@ -102,10 +102,10 @@ implementation { TWebMockAssertionsTests } uses - Delphi.WebMock.Assertion, DUnitX.Exceptions, System.Net.URLClient, System.RegularExpressions, - TestHelpers; + TestHelpers, + WebMock.Assertion; procedure TWebMockAssertionsTests.DeleteWasRequested_MatchingRequest_Passes; begin diff --git a/Tests/Features/Delphi.WebMock.DynamicMatching.Tests.pas b/Tests/Features/WebMock.DynamicMatching.Tests.pas similarity index 95% rename from Tests/Features/Delphi.WebMock.DynamicMatching.Tests.pas rename to Tests/Features/WebMock.DynamicMatching.Tests.pas index 2efbe70..65e4357 100644 --- a/Tests/Features/Delphi.WebMock.DynamicMatching.Tests.pas +++ b/Tests/Features/WebMock.DynamicMatching.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.DynamicMatching.Tests; +unit WebMock.DynamicMatching.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock; + WebMock; type [TestFixture] @@ -56,9 +56,9 @@ TWebMockDynamicMatchingTests = class(TObject) implementation uses - Delphi.WebMock.HTTP.Messages, Delphi.WebMock.ResponseStatus, System.Classes, System.Net.HttpClient, - TestHelpers; + TestHelpers, + WebMock.HTTP.Messages, WebMock.ResponseStatus; { TWebMockDynamicMatchingTests } diff --git a/Tests/Features/Delphi.WebMock.History.Tests.pas b/Tests/Features/WebMock.History.Tests.pas similarity index 94% rename from Tests/Features/Delphi.WebMock.History.Tests.pas rename to Tests/Features/WebMock.History.Tests.pas index b436580..ead243c 100644 --- a/Tests/Features/Delphi.WebMock.History.Tests.pas +++ b/Tests/Features/WebMock.History.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,15 +23,15 @@ { } {******************************************************************************} -unit Delphi.WebMock.History.Tests; +unit WebMock.History.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, System.Classes, - System.SysUtils; + System.SysUtils, + WebMock; type [TestFixture] @@ -56,9 +56,9 @@ implementation { TWebMockHistoryTests } uses - Delphi.WebMock.HTTP.Messages, System.Generics.Collections, - TestHelpers; + TestHelpers, + WebMock.HTTP.Messages; procedure TWebMockHistoryTests.History_AfterRequest_ContainsMatchingRequest; var diff --git a/Tests/Features/Delphi.WebMock.Matching.Tests.pas b/Tests/Features/WebMock.Matching.Tests.pas similarity index 97% rename from Tests/Features/Delphi.WebMock.Matching.Tests.pas rename to Tests/Features/WebMock.Matching.Tests.pas index 9c0a005..38d3c45 100644 --- a/Tests/Features/Delphi.WebMock.Matching.Tests.pas +++ b/Tests/Features/WebMock.Matching.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.Matching.Tests; +unit WebMock.Matching.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, - System.Classes, System.SysUtils; + System.Classes, System.SysUtils, + WebMock; type [TestFixture] @@ -79,11 +79,11 @@ TWebMockMatchingTests = class(TObject) implementation uses - Delphi.WebMock.RequestStub, - Delphi.WebMock.ResponseStatus, System.Net.HttpClient, System.Net.URLClient, System.RegularExpressions, System.StrUtils, - TestHelpers; + TestHelpers, + WebMock.RequestStub, + WebMock.ResponseStatus; procedure TWebMockMatchingTests.Request_MatchingMultipleHeadersStringList_RespondsOK; var diff --git a/Tests/Features/Delphi.WebMock.MatchingBody.Tests.pas b/Tests/Features/WebMock.MatchingBody.Tests.pas similarity index 96% rename from Tests/Features/Delphi.WebMock.MatchingBody.Tests.pas rename to Tests/Features/WebMock.MatchingBody.Tests.pas index 9802305..ac85e91 100644 --- a/Tests/Features/Delphi.WebMock.MatchingBody.Tests.pas +++ b/Tests/Features/WebMock.MatchingBody.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.MatchingBody.Tests; +unit WebMock.MatchingBody.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, - System.Classes, System.SysUtils; + System.Classes, System.SysUtils, + WebMock; type diff --git a/Tests/Features/Delphi.WebMock.Responses.Tests.pas b/Tests/Features/WebMock.Responses.Tests.pas similarity index 96% rename from Tests/Features/Delphi.WebMock.Responses.Tests.pas rename to Tests/Features/WebMock.Responses.Tests.pas index ed58df8..5e84f5a 100644 --- a/Tests/Features/Delphi.WebMock.Responses.Tests.pas +++ b/Tests/Features/WebMock.Responses.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,15 +23,15 @@ { } {******************************************************************************} -unit Delphi.WebMock.Responses.Tests; +unit WebMock.Responses.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, System.Classes, - System.SysUtils; + System.SysUtils, + WebMock; type @@ -63,9 +63,9 @@ implementation { TWebMockResponsesTests } uses - Delphi.WebMock.ResponseStatus, System.Net.HttpClient, System.Net.URLClient, System.StrUtils, - TestHelpers; + TestHelpers, + WebMock.ResponseStatus; procedure TWebMockResponsesTests.Response_WhenRequestAuthorizationHeaderIsNotBasic_ItRespondsWithoutError; var diff --git a/Tests/Features/Delphi.WebMock.ResponsesWithBody.Tests.pas b/Tests/Features/WebMock.ResponsesWithBody.Tests.pas similarity index 97% rename from Tests/Features/Delphi.WebMock.ResponsesWithBody.Tests.pas rename to Tests/Features/WebMock.ResponsesWithBody.Tests.pas index 1433460..b7991db 100644 --- a/Tests/Features/Delphi.WebMock.ResponsesWithBody.Tests.pas +++ b/Tests/Features/WebMock.ResponsesWithBody.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,15 +23,15 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponsesWithBody.Tests; +unit WebMock.ResponsesWithBody.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, System.Classes, - System.SysUtils; + System.SysUtils, + WebMock; type diff --git a/Tests/Features/Delphi.WebMock.ResponsesWithHeaders.Tests.pas b/Tests/Features/WebMock.ResponsesWithHeaders.Tests.pas similarity index 96% rename from Tests/Features/Delphi.WebMock.ResponsesWithHeaders.Tests.pas rename to Tests/Features/WebMock.ResponsesWithHeaders.Tests.pas index 7c19085..9046f72 100644 --- a/Tests/Features/Delphi.WebMock.ResponsesWithHeaders.Tests.pas +++ b/Tests/Features/WebMock.ResponsesWithHeaders.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,15 +23,15 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponsesWithHeaders.Tests; +unit WebMock.ResponsesWithHeaders.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, System.Classes, - System.SysUtils; + System.SysUtils, + WebMock; type diff --git a/Tests/Mock.Indy.HTTPRequestInfo.pas b/Tests/Mock.Indy.HTTPRequestInfo.pas index 174264f..e0e01cf 100644 --- a/Tests/Mock.Indy.HTTPRequestInfo.pas +++ b/Tests/Mock.Indy.HTTPRequestInfo.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } diff --git a/Tests/TestHelpers.pas b/Tests/TestHelpers.pas index ad28e66..2d29547 100644 --- a/Tests/TestHelpers.pas +++ b/Tests/TestHelpers.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } diff --git a/Tests/Delphi.WebMock.Assertion.Tests.pas b/Tests/WebMock.Assertion.Tests.pas similarity index 96% rename from Tests/Delphi.WebMock.Assertion.Tests.pas rename to Tests/WebMock.Assertion.Tests.pas index 3a03e91..180f68e 100644 --- a/Tests/Delphi.WebMock.Assertion.Tests.pas +++ b/Tests/WebMock.Assertion.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.Assertion.Tests; +unit WebMock.Assertion.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.Assertion, Delphi.WebMock.HTTP.Messages, - System.Classes, System.Generics.Collections, System.SysUtils; + System.Classes, System.Generics.Collections, System.SysUtils, + WebMock.Assertion, WebMock.HTTP.Messages; type [TestFixture] @@ -108,11 +108,11 @@ implementation { TWebMockAssertionTests } uses - Delphi.WebMock.HTTP.Request, Delphi.WebMock.StringRegExMatcher, - Delphi.WebMock.StringMatcher, Delphi.WebMock.StringWildcardMatcher, DUnitX.Exceptions, Mock.Indy.HTTPRequestInfo, - System.RegularExpressions; + System.RegularExpressions, + WebMock.HTTP.Request, WebMock.StringRegExMatcher, WebMock.StringMatcher, + WebMock.StringWildcardMatcher; procedure TWebMockAssertionTests.Delete_Always_ReturnsSelf; begin diff --git a/Tests/Delphi.WebMock.Dynamic.RequestStub.Tests.pas b/Tests/WebMock.Dynamic.RequestStub.Tests.pas similarity index 94% rename from Tests/Delphi.WebMock.Dynamic.RequestStub.Tests.pas rename to Tests/WebMock.Dynamic.RequestStub.Tests.pas index 4fe0ac3..7d3a9dd 100644 --- a/Tests/Delphi.WebMock.Dynamic.RequestStub.Tests.pas +++ b/Tests/WebMock.Dynamic.RequestStub.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.Dynamic.RequestStub.Tests; +unit WebMock.Dynamic.RequestStub.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.Dynamic.RequestStub; + WebMock.Dynamic.RequestStub; type [TestFixture] @@ -60,11 +60,10 @@ TWebMockDynamicRequestStubTests = class(TObject) implementation uses - Delphi.WebMock.HTTP.Messages, Delphi.WebMock.HTTP.Request, - Delphi.WebMock.RequestStub, Delphi.WebMock.Response, - Delphi.WebMock.ResponseStatus, Mock.Indy.HTTPRequestInfo, - IdCustomHTTPServer; + IdCustomHTTPServer, + WebMock.HTTP.Messages, WebMock.HTTP.Request, WebMock.RequestStub, + WebMock.Response, WebMock.ResponseStatus; { TWebMockDynamicRequestStubTests } diff --git a/Tests/Delphi.WebMock.HTTP.Request.Tests.pas b/Tests/WebMock.HTTP.Request.Tests.pas similarity index 97% rename from Tests/Delphi.WebMock.HTTP.Request.Tests.pas rename to Tests/WebMock.HTTP.Request.Tests.pas index f458330..f3bfc92 100644 --- a/Tests/Delphi.WebMock.HTTP.Request.Tests.pas +++ b/Tests/WebMock.HTTP.Request.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.HTTP.Request.Tests; +unit WebMock.HTTP.Request.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.HTTP.Request; + WebMock.HTTP.Request; type [TestFixture] diff --git a/Tests/Delphi.WebMock.HTTP.RequestMatcher.Tests.pas b/Tests/WebMock.HTTP.RequestMatcher.Tests.pas similarity index 95% rename from Tests/Delphi.WebMock.HTTP.RequestMatcher.Tests.pas rename to Tests/WebMock.HTTP.RequestMatcher.Tests.pas index 1a7e485..bb22302 100644 --- a/Tests/Delphi.WebMock.HTTP.RequestMatcher.Tests.pas +++ b/Tests/WebMock.HTTP.RequestMatcher.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.HTTP.RequestMatcher.Tests; +unit WebMock.HTTP.RequestMatcher.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.HTTP.RequestMatcher, + WebMock.HTTP.RequestMatcher, IdCustomHTTPServer; type @@ -73,12 +73,11 @@ TWebMockHTTPRequestMatcherTests = class(TObject) implementation uses - Delphi.WebMock.StringMatcher, Delphi.WebMock.StringAnyMatcher, - Delphi.WebMock.StringWildcardMatcher, Mock.Indy.HTTPRequestInfo, TestHelpers, - System.Classes, System.Generics.Collections, Delphi.WebMock.HTTP.Messages, - Delphi.WebMock.HTTP.Request; + System.Classes, System.Generics.Collections, + WebMock.HTTP.Messages, WebMock.HTTP.Request, WebMock.StringMatcher, + WebMock.StringAnyMatcher, WebMock.StringWildcardMatcher; { TWebMockHTTPRequestMatcherTests } diff --git a/Tests/Delphi.WebMock.Response.Tests.pas b/Tests/WebMock.Response.Tests.pas similarity index 97% rename from Tests/Delphi.WebMock.Response.Tests.pas rename to Tests/WebMock.Response.Tests.pas index 4e4f156..ee4af18 100644 --- a/Tests/Delphi.WebMock.Response.Tests.pas +++ b/Tests/WebMock.Response.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.Response.Tests; +unit WebMock.Response.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.Response; + WebMock.Response; type @@ -73,9 +73,9 @@ implementation { TWebMockResponseTests } uses - Delphi.WebMock.ResponseStatus, System.Classes, - TestHelpers; + TestHelpers, + WebMock.ResponseStatus; procedure TWebMockResponseTests.Setup; begin diff --git a/Tests/Delphi.WebMock.ResponseContentFile.Tests.pas b/Tests/WebMock.ResponseContentFile.Tests.pas similarity index 96% rename from Tests/Delphi.WebMock.ResponseContentFile.Tests.pas rename to Tests/WebMock.ResponseContentFile.Tests.pas index 64eae79..9df615d 100644 --- a/Tests/Delphi.WebMock.ResponseContentFile.Tests.pas +++ b/Tests/WebMock.ResponseContentFile.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponseContentFile.Tests; +unit WebMock.ResponseContentFile.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.ResponseContentFile; + WebMock.ResponseContentFile; type diff --git a/Tests/Delphi.WebMock.ResponseContentString.Tests.pas b/Tests/WebMock.ResponseContentString.Tests.pas similarity index 96% rename from Tests/Delphi.WebMock.ResponseContentString.Tests.pas rename to Tests/WebMock.ResponseContentString.Tests.pas index da0eb1e..7e3691b 100644 --- a/Tests/Delphi.WebMock.ResponseContentString.Tests.pas +++ b/Tests/WebMock.ResponseContentString.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponseContentString.Tests; +unit WebMock.ResponseContentString.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.ResponseContentString; + WebMock.ResponseContentString; type diff --git a/Tests/Delphi.WebMock.ResponseStatus.Tests.pas b/Tests/WebMock.ResponseStatus.Tests.pas similarity index 99% rename from Tests/Delphi.WebMock.ResponseStatus.Tests.pas rename to Tests/WebMock.ResponseStatus.Tests.pas index 7adc862..e21a83e 100644 --- a/Tests/Delphi.WebMock.ResponseStatus.Tests.pas +++ b/Tests/WebMock.ResponseStatus.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.ResponseStatus.Tests; +unit WebMock.ResponseStatus.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.ResponseStatus; + WebMock.ResponseStatus; type diff --git a/Tests/Delphi.WebMock.Static.RequestStub.Tests.pas b/Tests/WebMock.Static.RequestStub.Tests.pas similarity index 94% rename from Tests/Delphi.WebMock.Static.RequestStub.Tests.pas rename to Tests/WebMock.Static.RequestStub.Tests.pas index 49067d0..4dcf1ec 100644 --- a/Tests/Delphi.WebMock.Static.RequestStub.Tests.pas +++ b/Tests/WebMock.Static.RequestStub.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,13 +23,13 @@ { } {******************************************************************************} -unit Delphi.WebMock.Static.RequestStub.Tests; +unit WebMock.Static.RequestStub.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.Static.RequestStub; + WebMock.Static.RequestStub; type @@ -79,13 +79,12 @@ TWebMockStaticRequestStubTests = class(TObject) implementation uses - Delphi.WebMock.HTTP.RequestMatcher, Delphi.WebMock.RequestStub, - Delphi.WebMock.Response, Delphi.WebMock.ResponseStatus, - Delphi.WebMock.StringMatcher, Delphi.WebMock.StringWildcardMatcher, - Delphi.WebMock.StringRegExMatcher, IdCustomHTTPServer, Mock.Indy.HTTPRequestInfo, - System.Classes, System.RegularExpressions; + System.Classes, System.RegularExpressions, + WebMock.HTTP.RequestMatcher, WebMock.RequestStub, WebMock.Response, + WebMock.ResponseStatus, WebMock.StringMatcher, WebMock.StringWildcardMatcher, + WebMock.StringRegExMatcher; { TWebMockRequestStubTests } diff --git a/Tests/Delphi.WebMock.StringAnyMatcher.Tests.pas b/Tests/WebMock.StringAnyMatcher.Tests.pas similarity index 93% rename from Tests/Delphi.WebMock.StringAnyMatcher.Tests.pas rename to Tests/WebMock.StringAnyMatcher.Tests.pas index a450cae..6d49b15 100644 --- a/Tests/Delphi.WebMock.StringAnyMatcher.Tests.pas +++ b/Tests/WebMock.StringAnyMatcher.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.StringAnyMatcher.Tests; +unit WebMock.StringAnyMatcher.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.StringAnyMatcher, - IdCustomHTTPServer; + IdCustomHTTPServer, + WebMock.StringAnyMatcher; type diff --git a/Tests/Delphi.WebMock.StringRegExMatcher.Tests.pas b/Tests/WebMock.StringRegExMatcher.Tests.pas similarity index 93% rename from Tests/Delphi.WebMock.StringRegExMatcher.Tests.pas rename to Tests/WebMock.StringRegExMatcher.Tests.pas index 5b47000..d2a9870 100644 --- a/Tests/Delphi.WebMock.StringRegExMatcher.Tests.pas +++ b/Tests/WebMock.StringRegExMatcher.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.StringRegExMatcher.Tests; +unit WebMock.StringRegExMatcher.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.StringRegExMatcher, - IdCustomHTTPServer; + IdCustomHTTPServer, + WebMock.StringRegExMatcher; type @@ -58,8 +58,8 @@ implementation { TWebMockStringRegExMatcherTests } uses - Delphi.WebMock.StringMatcher, - System.RegularExpressions; + System.RegularExpressions, + WebMock.StringMatcher; procedure TWebMockStringRegExMatcherTests.Class_Always_ImplementsStringMatcher; var diff --git a/Tests/Delphi.WebMock.StringWildcardMatcher.Tests.pas b/Tests/WebMock.StringWildcardMatcher.Tests.pas similarity index 95% rename from Tests/Delphi.WebMock.StringWildcardMatcher.Tests.pas rename to Tests/WebMock.StringWildcardMatcher.Tests.pas index 003ce7f..3caf281 100644 --- a/Tests/Delphi.WebMock.StringWildcardMatcher.Tests.pas +++ b/Tests/WebMock.StringWildcardMatcher.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,14 +23,14 @@ { } {******************************************************************************} -unit Delphi.WebMock.StringWildcardMatcher.Tests; +unit WebMock.StringWildcardMatcher.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock.StringWildcardMatcher, - IdCustomHTTPServer; + IdCustomHTTPServer, + WebMock.StringWildcardMatcher; type @@ -63,7 +63,7 @@ implementation { TWebMockStringWildcardMatcherTests } -uses Delphi.WebMock.StringMatcher; +uses WebMock.StringMatcher; procedure TWebMockStringWildcardMatcherTests.Class_Always_ImplementsStringMatcher; var diff --git a/Tests/Delphi.WebMock.Tests.pas b/Tests/WebMock.Tests.pas similarity index 95% rename from Tests/Delphi.WebMock.Tests.pas rename to Tests/WebMock.Tests.pas index 1cbcc9c..ec4b685 100644 --- a/Tests/Delphi.WebMock.Tests.pas +++ b/Tests/WebMock.Tests.pas @@ -1,4 +1,4 @@ -{******************************************************************************} +{******************************************************************************} { } { Delphi-WebMocks } { } @@ -23,15 +23,15 @@ { } {******************************************************************************} -unit Delphi.WebMock.Tests; +unit WebMock.Tests; interface uses DUnitX.TestFramework, - Delphi.WebMock, System.Classes, - System.SysUtils; + System.SysUtils, + WebMock; type @@ -77,9 +77,9 @@ TWebMockTests = class(TObject) implementation uses - Delphi.WebMock.RequestStub, Delphi.WebMock.Static.RequestStub, System.Net.HttpClient, System.RegularExpressions, System.StrUtils, - TestHelpers; + TestHelpers, + WebMock.RequestStub, WebMock.Static.RequestStub; procedure TWebMockTests.Setup; begin @@ -127,7 +127,7 @@ procedure TWebMockTests.Create_WithNoArguments_StartsListeningOnPortGreaterThan8 begin LResponse := WebClient.Get(WebMock.URLFor('/')); - Assert.IsTrue(WebMock.Port > 8080); + Assert.IsTrue(WebMock.Port >= 8080); end; procedure TWebMockTests.Create_WithPort_StartsListeningOnPortPort; diff --git a/Tests/WebMocks.Tests.dpr b/Tests/WebMocks.Tests.dpr new file mode 100644 index 0000000..1587250 --- /dev/null +++ b/Tests/WebMocks.Tests.dpr @@ -0,0 +1,104 @@ +program WebMocks.Tests; + +{$IFNDEF TESTINSIGHT} +{$APPTYPE CONSOLE} +{$ENDIF}{$STRONGLINKTYPES ON} + +{$WARN DUPLICATE_CTOR_DTOR OFF} + +uses + System.SysUtils, + {$IFDEF TESTINSIGHT} + TestInsight.DUnitX, + {$ENDIF } + DUnitX.Loggers.Console, + DUnitX.Loggers.Xml.NUnit, + DUnitX.TestFramework, + WebMock.Tests in 'WebMock.Tests.pas', + WebMock in '..\Source\WebMock.pas', + TestHelpers in 'TestHelpers.pas', + WebMock.Static.RequestStub.Tests in 'WebMock.Static.RequestStub.Tests.pas', + WebMock.Static.RequestStub in '..\Source\WebMock.Static.RequestStub.pas', + WebMock.HTTP.RequestMatcher.Tests in 'WebMock.HTTP.RequestMatcher.Tests.pas', + WebMock.HTTP.RequestMatcher in '..\Source\WebMock.HTTP.RequestMatcher.pas', + Mock.Indy.HTTPRequestInfo in 'Mock.Indy.HTTPRequestInfo.pas', + WebMock.ResponseStatus.Tests in 'WebMock.ResponseStatus.Tests.pas', + WebMock.ResponseStatus in '..\Source\WebMock.ResponseStatus.pas', + WebMock.Response.Tests in 'WebMock.Response.Tests.pas', + WebMock.Response in '..\Source\WebMock.Response.pas', + WebMock.ResponseContentString.Tests in 'WebMock.ResponseContentString.Tests.pas', + WebMock.ResponseContentString in '..\Source\WebMock.ResponseContentString.pas', + WebMock.ResponseBodySource in '..\Source\WebMock.ResponseBodySource.pas', + WebMock.ResponseContentFile.Tests in 'WebMock.ResponseContentFile.Tests.pas', + WebMock.ResponseContentFile in '..\Source\WebMock.ResponseContentFile.pas', + WebMock.Matching.Tests in 'Features\WebMock.Matching.Tests.pas', + WebMock.StringWildcardMatcher.Tests in 'WebMock.StringWildcardMatcher.Tests.pas', + WebMock.StringWildcardMatcher in '..\Source\WebMock.StringWildcardMatcher.pas', + WebMock.StringMatcher in '..\Source\WebMock.StringMatcher.pas', + WebMock.StringRegExMatcher.Tests in 'WebMock.StringRegExMatcher.Tests.pas', + WebMock.StringRegExMatcher in '..\Source\WebMock.StringRegExMatcher.pas', + WebMock.ResponsesWithHeaders.Tests in 'Features\WebMock.ResponsesWithHeaders.Tests.pas', + WebMock.ResponsesWithBody.Tests in 'Features\WebMock.ResponsesWithBody.Tests.pas', + WebMock.MatchingBody.Tests in 'Features\WebMock.MatchingBody.Tests.pas', + WebMock.StringAnyMatcher.Tests in 'WebMock.StringAnyMatcher.Tests.pas', + WebMock.StringAnyMatcher in '..\Source\WebMock.StringAnyMatcher.pas', + WebMock.History.Tests in 'Features\WebMock.History.Tests.pas', + WebMock.HTTP.Messages in '..\Source\WebMock.HTTP.Messages.pas', + WebMock.HTTP.Request.Tests in 'WebMock.HTTP.Request.Tests.pas', + WebMock.HTTP.Request in '..\Source\WebMock.HTTP.Request.pas', + WebMock.Responses.Tests in 'Features\WebMock.Responses.Tests.pas', + WebMock.Assertions.Tests in 'Features\WebMock.Assertions.Tests.pas', + WebMock.Assertion in '..\Source\WebMock.Assertion.pas', + WebMock.Assertion.Tests in 'WebMock.Assertion.Tests.pas', + WebMock.DynamicMatching.Tests in 'Features\WebMock.DynamicMatching.Tests.pas', + WebMock.Dynamic.RequestStub.Tests in 'WebMock.Dynamic.RequestStub.Tests.pas', + WebMock.Dynamic.RequestStub in '..\Source\WebMock.Dynamic.RequestStub.pas', + WebMock.RequestStub in '..\Source\WebMock.RequestStub.pas'; + +var + Runner: ITestRunner; + Results: IRunResults; + Logger: ITestLogger; + NUnitLogger: ITestLogger; + +begin +{$IFDEF TESTINSIGHT} + TestInsight.DUnitX.RunRegisteredTests; + exit; +{$ENDIF} + try + // Check command line options, will exit if invalid + TDUnitX.CheckCommandLine; + // Create the test runner + Runner := TDUnitX.CreateRunner; + // Tell the runner to use RTTI to find Fixtures + Runner.UseRTTI := True; + // tell the runner how we will log things + // Log to the console window + Logger := TDUnitXConsoleLogger.Create(True); + Runner.AddLogger(Logger); + // Generate an NUnit compatible XML File + NUnitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile); + Runner.AddLogger(NUnitLogger); + Runner.FailsOnNoAsserts := False; + // When true, Assertions must be made during tests; + + // Run tests + Results := Runner.Execute; + if not Results.AllPassed then + System.ExitCode := EXIT_ERRORS; + +{$IFNDEF CI} + // We don't want this happening when running under CI. + if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then + begin + System.Write('Done.. press key to quit.'); + System.Readln; + end; +{$ENDIF} + except + on E: Exception do + System.Writeln(E.ClassName, ': ', E.Message); + end; + +end. diff --git a/Tests/Delphi.WebMocks.Tests.dproj b/Tests/WebMocks.Tests.dproj similarity index 94% rename from Tests/Delphi.WebMocks.Tests.dproj rename to Tests/WebMocks.Tests.dproj index a3df349..f8bee56 100644 --- a/Tests/Delphi.WebMocks.Tests.dproj +++ b/Tests/WebMocks.Tests.dproj @@ -3,7 +3,7 @@ {04081825-8AE9-4D09-A947-7FE0B62D328A} 19.1 None - Delphi.WebMocks.Tests.dpr + WebMocks.Tests.dpr True Debug Win32 @@ -61,7 +61,7 @@ $(BDS)\bin\delphi_PROJECTICON.ico $(BDS)\bin\delphi_PROJECTICNS.icns $(DUnitX);$(DCC_UnitSearchPath) - Delphi_WebMocks_Tests + WebMocks_Tests TESTINSIGHT;$(DCC_Define) @@ -102,46 +102,46 @@ MainSource - - + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cfg_2 Base @@ -160,7 +160,7 @@ - Delphi.WebMocks.Tests.dpr + WebMocks.Tests.dpr @@ -189,9 +189,9 @@ true - + - Delphi_WebMocks_Tests.exe + WebMocks_Tests.exe true diff --git a/Tests/WebMocks.Tests.res b/Tests/WebMocks.Tests.res new file mode 100644 index 0000000000000000000000000000000000000000..48f203c4a3f68f8df7c8a4f67ca1889069b7b898 GIT binary patch literal 109732 zcmeGl2Rv0@_}WpaC~1hYN-5eQRLY1#l%$Y`riw~MsI*8DDk?=XDs9s8(oPYjg=k7c zviJRe-^=rVHPQJLeDtK}Z3RG=Cll!$tM$*in#| z7HFH{B<=P>-G#v2UROuUm>@6=7tw|vUKT6D=MjYLIbE$WCXO$@WUO|So%_7>+t>U3 zM%|sas;hOs8GYN1958Xl9DlF&vwG-t8sFJ{n)4X%J$+0&ado+QE6KUj5h0!3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#srlo2-fp-vrXkxPv>B>L<7vzrANa0O&yO0mq5K2DE@$41;#!yw zXVb1;0__j1b-sUFx4hBxFX?_|L$)y5-*cztk2qYdk3&QG)6!)1jq7L)^Z{-{UbXFS z4G#vuw>tf6cJs&jt^wO)?9&dW(N6z{@5=#d<<#8#(Jl$gAAMSM|JTsxN&g?hpd12e zVX=?#49+BA22USXQO{_L0b7q<+e*plFlR}N-@qIDwsrVUpFjQwe;$BZ92!W2S^CWU zFz=?=LZd9|=tDDc!F~p|@l5Hi&xaabpicf!E}DP`_Gy(GN}JVh5T8~*U>((9Jy{Q* zVsK-B66dI6^z@?h6k z7EC=LP+(@m6{ZhpK(P4G!sD9)X=K%;hiPLTwNn{c0;DZyq!a-NQ13PVK0K_y9}OoI zFih<{1`ApYe89QNr2uE3Kl%s({+|V~0}zGe8hpSH<-HK#8vvv7ln;K30qUfIZU7&c zdn2*Ep$9yl5zj8tth@GteV^Ji;J+;Zbc@plHId`&xe4X{by(Zd5)r?P(7Eypj091PEBd6H)02(G zr}^V}3?I7wFv{p5&7V>JG=H>>#RuD4{8l61B$_{~@!!3zs*MkEqgajq@WFTdZ^YHw zXPtq#s58v@2jimM9{-Qc9PMh`DAZFNi+#m3=_zGP{^mSFSUb_rW;yPfZ$g z;Z3Cl-c+8{d!wGBuG2@Y^B??>AIQ@vpfd>p{{x_&{;(G#4|eB~{~ss*MlkZNIy)F2po(f=Ug5B!vh=LLaa(AtnGO#({1A5C44C7-B911-4E71-968A-1EDEC6B6689A} - + @@ -14,23 +14,23 @@ - - + + - - + + - - + + - + - + - + From 2fb2b4811407f4a61bc9feff6411a448a2e09ed9 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Wed, 18 Nov 2020 20:30:24 +0000 Subject: [PATCH 04/15] Remove packages for Delphinus installation Resolves #37. Removing the packages for Delphinus means the library can be installed into Delphi versions prior to 10.3. The test project has also been rebuilt to enable platforms other than Win32 which appears to have been disabled due to some project corruption (possibly in an upgrade from earlier version?). --- Delphinus.Info.json | 6 +- Delphinus.Install.json | 17 +- Packages/Delphi10Rio/WebMocks.dpk | 58 -- Packages/Delphi10Rio/WebMocks.dproj | 967 ------------------ Packages/Delphi10Rio/WebMocks.res | Bin 640 -> 0 bytes Packages/Delphi10Sydney/WebMocks.dpk | 58 -- Packages/Delphi10Sydney/WebMocks.dproj | 757 -------------- Packages/Delphi10Sydney/WebMocks.res | Bin 640 -> 0 bytes README.md | 20 +- .../WebMock.ResponsesWithBody.Tests.pas | 4 +- Tests/TestHelpers.pas | 6 +- Tests/WebMocks.Tests.dproj | 478 +++------ Tests/WebMocks.Tests.res | Bin 109732 -> 109732 bytes Tests/WebMocks.Tests_Icon.ico | Bin 0 -> 109403 bytes 14 files changed, 139 insertions(+), 2232 deletions(-) delete mode 100644 Packages/Delphi10Rio/WebMocks.dpk delete mode 100644 Packages/Delphi10Rio/WebMocks.dproj delete mode 100644 Packages/Delphi10Rio/WebMocks.res delete mode 100644 Packages/Delphi10Sydney/WebMocks.dpk delete mode 100644 Packages/Delphi10Sydney/WebMocks.dproj delete mode 100644 Packages/Delphi10Sydney/WebMocks.res create mode 100644 Tests/WebMocks.Tests_Icon.ico diff --git a/Delphinus.Info.json b/Delphinus.Info.json index fe06864..34a0978 100644 --- a/Delphinus.Info.json +++ b/Delphinus.Info.json @@ -2,10 +2,10 @@ "id": "{DFCA358E-5EF2-44CF-BE16-72B3634DC147}", "name": "WebMocks", "licenses": [{ "type": "Apache 2.0", "file": "LICENSE" }], - "platforms": "Win32;Win64", - "package_compiler_min": 33, + "platforms": "Linux64;OSX32;OSX64;Win32;Win64", + "package_compiler_min": 29, "package_compiler_max": 34, - "compiler_min": 33, + "compiler_min": 29, "compiler_max": 34, "dependencies": [] } diff --git a/Delphinus.Install.json b/Delphinus.Install.json index 9620d6c..edc6cc0 100644 --- a/Delphinus.Install.json +++ b/Delphinus.Install.json @@ -1,22 +1,11 @@ { "browsing_pathes": [ - { "pathes": "Source", "platforms": "Win32;Win64" } + { "pathes": "Source", "platforms": "Linux64;OSX32;OSX64;Win32;Win64" } ], "search_pathes": [ - { "pathes": "Source", "platforms": "Win32;Win64" } + { "pathes": "Source", "platforms": "Linux64;OSX32;OSX64;Win32;Win64" } ], "source_folders": [ - { "folder": "Source", "recursive": false, "filter": "*.pas" }, - { "folder": "Packages", "recursive": true } - ], - "projects": [ - { - "project": "Packages\\Delphi10Rio\\WebMocks.dproj", - "compiler": 33 - }, - { - "project": "Packages\\Delphi10Sydney\\WebMocks.dproj", - "compiler": 34 - } + { "folder": "Source", "recursive": false, "filter": "*.pas" } ] } diff --git a/Packages/Delphi10Rio/WebMocks.dpk b/Packages/Delphi10Rio/WebMocks.dpk deleted file mode 100644 index 68759f9..0000000 --- a/Packages/Delphi10Rio/WebMocks.dpk +++ /dev/null @@ -1,58 +0,0 @@ -package WebMocks; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST OFF} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'WebMocks for Delphi'} -{$LIBSUFFIX '.Delphi10Rio'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - rtl, - IndySystem, - IndyProtocols, - IndyCore; - -contains - Delphi.WebMock.Assertion in '..\..\Source\Delphi.WebMock.Assertion.pas', - Delphi.WebMock.Dynamic.RequestStub in '..\..\Source\Delphi.WebMock.Dynamic.RequestStub.pas', - Delphi.WebMock.HTTP.Messages in '..\..\Source\Delphi.WebMock.HTTP.Messages.pas', - Delphi.WebMock.HTTP.Request in '..\..\Source\Delphi.WebMock.HTTP.Request.pas', - Delphi.WebMock.HTTP.RequestMatcher in '..\..\Source\Delphi.WebMock.HTTP.RequestMatcher.pas', - Delphi.WebMock in '..\..\Source\Delphi.WebMock.pas', - Delphi.WebMock.RequestStub in '..\..\Source\Delphi.WebMock.RequestStub.pas', - Delphi.WebMock.Response in '..\..\Source\Delphi.WebMock.Response.pas', - Delphi.WebMock.ResponseBodySource in '..\..\Source\Delphi.WebMock.ResponseBodySource.pas', - Delphi.WebMock.ResponseContentFile in '..\..\Source\Delphi.WebMock.ResponseContentFile.pas', - Delphi.WebMock.ResponseContentString in '..\..\Source\Delphi.WebMock.ResponseContentString.pas', - Delphi.WebMock.ResponseStatus in '..\..\Source\Delphi.WebMock.ResponseStatus.pas', - Delphi.WebMock.Static.RequestStub in '..\..\Source\Delphi.WebMock.Static.RequestStub.pas', - Delphi.WebMock.StringAnyMatcher in '..\..\Source\Delphi.WebMock.StringAnyMatcher.pas', - Delphi.WebMock.StringMatcher in '..\..\Source\Delphi.WebMock.StringMatcher.pas', - Delphi.WebMock.StringRegExMatcher in '..\..\Source\Delphi.WebMock.StringRegExMatcher.pas', - Delphi.WebMock.StringWildcardMatcher in '..\..\Source\Delphi.WebMock.StringWildcardMatcher.pas'; - -end. diff --git a/Packages/Delphi10Rio/WebMocks.dproj b/Packages/Delphi10Rio/WebMocks.dproj deleted file mode 100644 index bcc9a33..0000000 --- a/Packages/Delphi10Rio/WebMocks.dproj +++ /dev/null @@ -1,967 +0,0 @@ - - - {3A444105-D81F-45DD-96A5-B2BD7C5963FB} - WebMocks.dpk - 18.8 - None - True - Debug - Win32 - 1 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - ..\..\Library\$(Platform)\$(Config) - .\$(Platform)\$(Config) - false - false - false - false - false - true - true - System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) - All - WebMocks - ..\..\Source\ - 2057 - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - WebMocks for Delphi - true - true - .Delphi10Rio - - - None - android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar - - - None - android-support-v4.dex.jar;cloud-messaging.dex.jar;com-google-android-gms.play-services-ads-base.17.2.0.dex.jar;com-google-android-gms.play-services-ads-identifier.16.0.0.dex.jar;com-google-android-gms.play-services-ads-lite.17.2.0.dex.jar;com-google-android-gms.play-services-ads.17.2.0.dex.jar;com-google-android-gms.play-services-analytics-impl.16.0.8.dex.jar;com-google-android-gms.play-services-analytics.16.0.8.dex.jar;com-google-android-gms.play-services-base.16.0.1.dex.jar;com-google-android-gms.play-services-basement.16.2.0.dex.jar;com-google-android-gms.play-services-gass.17.2.0.dex.jar;com-google-android-gms.play-services-identity.16.0.0.dex.jar;com-google-android-gms.play-services-maps.16.1.0.dex.jar;com-google-android-gms.play-services-measurement-base.16.4.0.dex.jar;com-google-android-gms.play-services-measurement-sdk-api.16.4.0.dex.jar;com-google-android-gms.play-services-stats.16.0.1.dex.jar;com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.dex.jar;com-google-android-gms.play-services-tasks.16.0.1.dex.jar;com-google-android-gms.play-services-wallet.16.0.1.dex.jar;com-google-firebase.firebase-analytics.16.4.0.dex.jar;com-google-firebase.firebase-common.16.1.0.dex.jar;com-google-firebase.firebase-iid-interop.16.0.1.dex.jar;com-google-firebase.firebase-iid.17.1.1.dex.jar;com-google-firebase.firebase-measurement-connector.17.0.1.dex.jar;com-google-firebase.firebase-messaging.17.5.0.dex.jar;fmx.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar - - - None - - - None - - - None - - - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 - - - DEBUG;$(DCC_Define) - true - false - true - true - true - - - false - true - 1033 - - - false - RELEASE;$(DCC_Define) - 0 - 0 - - - - MainSource - - - - - - - - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - WebMocks.dpk - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - - - true - - - - - true - - - - - true - - - - - WebMocks.bpl - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - False - False - False - False - False - False - False - False - True - False - - - 12 - - - - - diff --git a/Packages/Delphi10Rio/WebMocks.res b/Packages/Delphi10Rio/WebMocks.res deleted file mode 100644 index 86047452afa26f85842b2a3c29773303d2fe9819..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 640 zcmZva%}T>S6opSp7RHrZcP?B@lx&oO2vsTgM+|kTZ5k!mCKBu8`8Mu-1LHS0#-^nM zcQP~goHHl)jwJ07b=?HZ)zNG7J77G^g$n$CP%mOR(!Cy;&lR&8>Q*=Ghs+nO-T3ss zecHtg|;xBi>-+?OeSZS;|4hN={ zayAE>F;B=;+%wkHG)vAm-G5}>8@;JMU@W-9sb;3Ri4&RURnEHeb>GgRN7tOIwo=Q= zO8eH8#QvzD0yB`^+6DfX&+|~9sOxPiaHTUP*7KN}ChTHe(vgHNHlzD?T)%$-yW&)^ diff --git a/Packages/Delphi10Sydney/WebMocks.dpk b/Packages/Delphi10Sydney/WebMocks.dpk deleted file mode 100644 index be0c8c5..0000000 --- a/Packages/Delphi10Sydney/WebMocks.dpk +++ /dev/null @@ -1,58 +0,0 @@ -package WebMocks; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST OFF} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'WebMocks for Delphi'} -{$LIBSUFFIX '.Delphi10Sydney'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - rtl, - IndySystem, - IndyProtocols, - IndyCore; - -contains - Delphi.WebMock.Assertion in '..\..\Source\Delphi.WebMock.Assertion.pas', - Delphi.WebMock.Dynamic.RequestStub in '..\..\Source\Delphi.WebMock.Dynamic.RequestStub.pas', - Delphi.WebMock.HTTP.Messages in '..\..\Source\Delphi.WebMock.HTTP.Messages.pas', - Delphi.WebMock.HTTP.Request in '..\..\Source\Delphi.WebMock.HTTP.Request.pas', - Delphi.WebMock.HTTP.RequestMatcher in '..\..\Source\Delphi.WebMock.HTTP.RequestMatcher.pas', - Delphi.WebMock in '..\..\Source\Delphi.WebMock.pas', - Delphi.WebMock.RequestStub in '..\..\Source\Delphi.WebMock.RequestStub.pas', - Delphi.WebMock.Response in '..\..\Source\Delphi.WebMock.Response.pas', - Delphi.WebMock.ResponseBodySource in '..\..\Source\Delphi.WebMock.ResponseBodySource.pas', - Delphi.WebMock.ResponseContentFile in '..\..\Source\Delphi.WebMock.ResponseContentFile.pas', - Delphi.WebMock.ResponseContentString in '..\..\Source\Delphi.WebMock.ResponseContentString.pas', - Delphi.WebMock.ResponseStatus in '..\..\Source\Delphi.WebMock.ResponseStatus.pas', - Delphi.WebMock.Static.RequestStub in '..\..\Source\Delphi.WebMock.Static.RequestStub.pas', - Delphi.WebMock.StringAnyMatcher in '..\..\Source\Delphi.WebMock.StringAnyMatcher.pas', - Delphi.WebMock.StringMatcher in '..\..\Source\Delphi.WebMock.StringMatcher.pas', - Delphi.WebMock.StringRegExMatcher in '..\..\Source\Delphi.WebMock.StringRegExMatcher.pas', - Delphi.WebMock.StringWildcardMatcher in '..\..\Source\Delphi.WebMock.StringWildcardMatcher.pas'; - -end. diff --git a/Packages/Delphi10Sydney/WebMocks.dproj b/Packages/Delphi10Sydney/WebMocks.dproj deleted file mode 100644 index 3d7309e..0000000 --- a/Packages/Delphi10Sydney/WebMocks.dproj +++ /dev/null @@ -1,757 +0,0 @@ - - - {6C22A872-7731-43B3-9EE4-319CFCF4B3E7} - WebMocks.dpk - 19.0 - None - True - Debug - Win32 - 1 - Package - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_1 - true - true - - - true - Base - true - - - ..\..\Library\$(Platform)\$(Config) - .\$(Platform)\$(Config) - false - false - false - false - false - true - true - System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) - All - WebMocks - ..\..\Source\ - 2057 - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - true - .Delphi10Sydney - WebMocks for Delphi - true - - - None - rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) - - - None - rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) - - - rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) - - - rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) - - - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 - rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) - - - rtl;IndySystem;IndyProtocols;IndyCore;$(DCC_UsePackage) - - - DEBUG;$(DCC_Define) - true - false - true - true - true - - - false - true - 1033 - - - false - RELEASE;$(DCC_Define) - 0 - 0 - - - - MainSource - - - - - - - - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - WebMocks.dpk - - - - False - False - False - False - True - False - - - - - true - - - - - true - - - - - true - - - - - WebMocks.bpl - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - 12 - - - - - diff --git a/Packages/Delphi10Sydney/WebMocks.res b/Packages/Delphi10Sydney/WebMocks.res deleted file mode 100644 index 86047452afa26f85842b2a3c29773303d2fe9819..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 640 zcmZva%}T>S6opSp7RHrZcP?B@lx&oO2vsTgM+|kTZ5k!mCKBu8`8Mu-1LHS0#-^nM zcQP~goHHl)jwJ07b=?HZ)zNG7J77G^g$n$CP%mOR(!Cy;&lR&8>Q*=Ghs+nO-T3ss zecHtg|;xBi>-+?OeSZS;|4hN={ zayAE>F;B=;+%wkHG)vAm-G5}>8@;JMU@W-9sb;3Ri4&RURnEHeb>GgRN7tOIwo=Q= zO8eH8#QvzD0yB`^+6DfX&+|~9sOxPiaHTUP*7KN}ChTHe(vgHNHlzD?T)%$-yW&)^ diff --git a/README.md b/README.md index 1f6488e..bdcf809 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,11 @@ Library for stubbing and setting expectations on HTTP requests in Delphi with * [DUnitX](https://github.com/VSoftTechnologies/DUnitX) * [Indy](https://www.indyproject.org) -\* Delphi-WebMocks was developed in Delphi 10.3 (Rio) and 10.4 (Sydney) and -runtime packages are provided for these versions. WebMocks has been reported -working on 10.1 (Berlin). I'd be interested to hear from anyone working on other -versions. As Delphi-WebMocks makes use of the `System.Net library introduced -with XE8 it will not be compatible with earlier versions. Should anyone wish to -provide a runtime package for a version earlier than 10.3 Rio then please open a -pull-request. +\* Delphi-WebMocks was developed in Delphi 10.3 (Rio) and 10.4 (Sydney). +WebMocks has been reported working on 10.1 (Berlin). I'd be interested to hear +from anyone working on other versions. As Delphi-WebMocks makes use of the +`System.Net library introduced with XE8 it will not be compatible with earlier +versions. ## Optional Dependencies * [TestInsight](https://bitbucket.org/sglienke/testinsight/wiki/Home) is @@ -25,12 +23,14 @@ pull-request. WebMocks should now be listed in [Delphinus](https://github.com/Memnarch/Delphinus) package manager. +Be sure to restart Delphi after installing via Delphinus otherwise the units may +not be found in your test projects. + ## Installation: Manual 1. Download and extract the latest version [1.3.0](https://github.com/appercept/Delphi-WebMocks/archive/1.3.0.zip). -2. Open the package appropriate for your Delphi version in the `Packages` - folder. -3. Build and install the package. +2. In "Tools > Options" under the "Language / Delphi / Library" add the + extracted `Source` directory to the "Library path" and "Browsing path". ## Setup In your test unit file a couple of simple steps are required. diff --git a/Tests/Features/WebMock.ResponsesWithBody.Tests.pas b/Tests/Features/WebMock.ResponsesWithBody.Tests.pas index b7991db..97eb56b 100644 --- a/Tests/Features/WebMock.ResponsesWithBody.Tests.pas +++ b/Tests/Features/WebMock.ResponsesWithBody.Tests.pas @@ -81,11 +81,11 @@ procedure TWebMockResponsesWithBodyTests.Response_WhenWithBodyFileOnMultipleCall // First request LResponse := WebClient.Get(WebMock.URLFor('json')); - Assert.AreEqual(LExpected, LResponse.ContentAsString); + Assert.AreEqual(LExpected, LResponse.ContentAsString, 'on first request'); // Second request LResponse := WebClient.Get(WebMock.URLFor('json')); - Assert.AreEqual(LExpected, LResponse.ContentAsString); + Assert.AreEqual(LExpected, LResponse.ContentAsString, 'on second request'); end; procedure TWebMockResponsesWithBodyTests.Response_WhenWithBodyFileWithContentType_SetsContentType; diff --git a/Tests/TestHelpers.pas b/Tests/TestHelpers.pas index 2d29547..e2a42ca 100644 --- a/Tests/TestHelpers.pas +++ b/Tests/TestHelpers.pas @@ -42,11 +42,15 @@ function NetHeadersToStrings(ANetHeaders: TNetHeaders): TStringList; implementation uses + System.IOUtils, System.SysUtils; function FixturePath(const AFileName: string): string; +var + LFixtureDir: string; begin - Result := Format('../../Fixtures/%s', [AFileName]); + LFixtureDir := TPath.Combine(TDirectory.GetCurrentDirectory, 'Fixtures'); + Result := TPath.Combine(LFixtureDir, AFileName); end; function GetPropertyValue(AObject: TObject; APropertyName: string): TValue; diff --git a/Tests/WebMocks.Tests.dproj b/Tests/WebMocks.Tests.dproj index f8bee56..fc05794 100644 --- a/Tests/WebMocks.Tests.dproj +++ b/Tests/WebMocks.Tests.dproj @@ -1,14 +1,14 @@  - {04081825-8AE9-4D09-A947-7FE0B62D328A} - 19.1 - None + {29E93520-48F5-4A74-9C5F-30E749D38AF2} WebMocks.Tests.dpr True Debug - Win32 - 1 + 5251 Console + None + 19.1 + Win32 true @@ -33,70 +33,114 @@ Base true - + true Base true - - true - Cfg_1 - true + + true + Base true - + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 true - Base true - .\$(Platform)\$(Config) - .\$(Platform)\$(Config) false - false - false false false + false + false + 00400000 + WebMocks_Tests + 2057 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName= System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) $(BDS)\bin\delphi_PROJECTICON.ico $(BDS)\bin\delphi_PROJECTICNS.icns - $(DUnitX);$(DCC_UnitSearchPath) - WebMocks_Tests - TESTINSIGHT;$(DCC_Define) + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) - DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage) $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_1024x1024.png - DBXSqliteDriver;RESTComponents;fmxase;DBXInterBaseDriver;emsclientfiredac;tethering;DataSnapFireDAC;bindcompfmx;fmx;FireDACIBDriver;FireDACDBXDriver;dbexpress;IndyCore;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;soaprtl;DbxCommonDriver;xmlrtl;soapmidas;DataSnapNativeClient;FireDACDSDriver;rtl;DbxClientDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage) + CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri;ITSAppUsesNonExemptEncryption=false;NSBluetoothAlwaysUsageDescription=The reason for accessing bluetooth;NSBluetoothPeripheralUsageDescription=The reason for accessing bluetooth peripherals;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSMotionUsageDescription=The reason for accessing the accelerometer;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers + iPhoneAndiPad + true + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_60x60.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_NotificationIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png - DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;tethering;svnui;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;emsedge;fmx;FireDACIBDriver;fmxdae;OAuth2;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage) Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) 1033 + WebMocks.Tests_Icon.ico + TESTINSIGHT;$(DCC_Define) + (None) - DBXSqliteDriver;RESTComponents;fmxase;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;tethering;DataSnapFireDAC;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;DBXOracleDriver;inetdb;emsedge;fmx;FireDACIBDriver;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;emsclient;DataSnapCommon;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;CloudService;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;IndyIPCommon;bindcompdbx;vcl;IndyIPServer;DBXSybaseASEDriver;IndySystem;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;soaprtl;DbxCommonDriver;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;emsserverresource;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;inetdbxpress;FireDACMongoDBDriver;DataSnapServerMidas;$(DCC_UsePackage) + WebMocks.Tests_Icon.ico + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + RELEASE;$(DCC_Define) + 0 + false + 0 + + DEBUG;$(DCC_Define) - true false true - true + + + Debug + + true - - false + + Debug + /usr/X11/bin/xterm -e "%debuggee%" + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleVersion=1.0.0 + (None) - - false - RELEASE;$(DCC_Define) - 0 - 0 + + 1033 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName) + WebMocks.Tests_Icon.ico @@ -142,56 +186,81 @@ - + Cfg_2 Base Base - + Cfg_1 Base Delphi.Personality.12 - Console + WebMocks.Tests.dpr + + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + True + False + True + True + True + True + - + + + true + + + + WebMocks_Tests true - - + + + WebMocks.icns true - - + + true - + + + Info.plist + true + + + true - - + + true - - - WebMocks_Tests.exe + + + WebMocks_Tests true @@ -587,138 +656,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset @@ -729,28 +666,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset @@ -811,105 +726,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset @@ -920,17 +736,6 @@ 1 - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset @@ -941,50 +746,6 @@ 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset @@ -1083,7 +844,6 @@ 1 - @@ -1187,12 +947,6 @@ - - False - False - True - False - 12 diff --git a/Tests/WebMocks.Tests.res b/Tests/WebMocks.Tests.res index 48f203c4a3f68f8df7c8a4f67ca1889069b7b898..aa8eec733c56cb6637ffdbe5ef0c1909152eead6 100644 GIT binary patch delta 23 fcmZ2-lWoaOwuUW?B5N2Kri-p&>}F{eVPF6NZlwo& delta 23 fcmZ2-lWoaOwuUW?B5N2Gri-p&>}FwPU|;|MZNUcy diff --git a/Tests/WebMocks.Tests_Icon.ico b/Tests/WebMocks.Tests_Icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..5f7e2a6ec813420535fcf0634a85bab6d5eea4c5 GIT binary patch literal 109403 zcmeHQ2|QF?6d!w9RFtGd38fS*DuhZ|q7Wr1q(xd(R4PKH1xZ4pQY1^IowS*>r-;&q zXhn-;-`{u6d`3fN3^UsFe!nws?t6DR=lt(}&%KXC;vn&osMi-M5@``QTwMNtGN=Ow zX@)e3q^@4)o=75X9L7PCm;c`#0scc*a*!k>>fGH(q^bTKq;7D>%bJ@+DmunN+NnQH zvr9+Oj_|09ww8t=2~tJsfJvLJj({|!&TDH-FmibLC3BsF)WR3#-@ZN=Jnr72wY@9{ z&l%Kd?9i!m7WjL0nb$|B`{W*Ovz#V)?;Bv;oulWi+sRJdk9O4B%flUMI9W;gNhh$F6bRl6b>LQ6VT<3AxU!u`K#XcQ#IW=th`u$ou8ajIob4Z7ZZV@Ji=U^HdJ3; z{n_W)Gp*o0#{Kk23Lny^3CZ&W@apo#a4oYCG~m3eb;rbq>y@MquPv!xfvkL26N~lv zN_iyXtWg{{ci1Wmxr({$58J&&ga5F$QjDc6X{yUJ*BsYz8apkoy^lL$zfwoYWl+{y zMXtUU<`&aK)>V8z6Pq_c%9=d)dRXgZ*=&y#*rn zKrEXLb28_VEy;^rPKH@U%^2dU>6-4UIW&2$l$d^K3b+1*YhONdJN6vQ?G%3M{4H_~ z`5{@zKj%XjmkoCyY0BN$gWt&eTx>b2x_3EikXF*sU_ij~_4&%F*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%~m5KtS{ew*s^3zoM8&=WZKdcOUEe{7ay>8pY`J(4BeMqMhP#LDzm|B`XH9XEO zHokBju+h8`=Cy7>Q>ft@-&>nL=6fuYjW0Zxqfr`q;BHXnXy3OseT-uxoO9p!!ab9; z@sE}++63*^z6Q@|a9|~U9Md+wZe6c#m_D?dfC<(~jh|E8tfUWe5v5@BLwg}6v}sY= z@1aEzw9jb&|BUp3PwX!@;EU>JC4IDMY<%4$Hp+Bxy zZ-O)@HBOi6W+nZm)=pL|_@Qmog|u+&iF2<%V9?t1w>7b5{1MjC#x^`(4Eu7>F<2qRreSlk#R(<>p z)%3BxYr?h|`?MpdveVw-`6{4#oLZYc+8tr}qm7H^|9aXqY5#*C#36|47yB5`;YbCT5XP290>+d%KM>EnNR&jnP^Llbc@il5OtOuHqv&WJ^W z{Lo5Xu%Cf#JVUt~>!D5;m?wWI7cJle`?T^+#m($92v4mau#Rf7o@~TVDY&seiS;_O z$uQ*);={Tc=cU$SyNP`Vq`E!~>Uc6xC#E8+^F-Oz1v4->eSlL5Fdu-dn!FmvGo z(+5-{F?mt_KBlVIToiKTp9#E(JMpu5ks>S?F&*MuPw6 zfNX(;Ai5?mc!zk}0DS|ZS6&L?-7=sCaiAN>2j)RmA zr#RO7igD2Lk2sw@Sw&#`f$Ox?3vsQ(5A!MY+}TBq!&CiJ?`Y?Lzz_1z_rBH=Y6gU` zn2)@0eGmI+w6qn@NLoI>lu%V@Fjn`$Ftk@)91G!2kp=D)oiw^*KE=FF8??cHc!&Bx lokoM4$w>Gg2=nO=dnpQ_r$~l*R2OJPkea)w{xA%N{SQv>i|7CV literal 0 HcmV?d00001 From dbcfb51655e73780077689f1ac4c85f6f8596066 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Thu, 19 Nov 2020 12:17:27 +0000 Subject: [PATCH 05/15] Update README with note about unreleased changes --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bdcf809..82092a9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Delphi-WebMocks +# WebMocks Library for stubbing and setting expectations on HTTP requests in Delphi with [DUnitX](https://github.com/VSoftTechnologies/DUnitX). @@ -32,6 +32,11 @@ not be found in your test projects. 2. In "Tools > Options" under the "Language / Delphi / Library" add the extracted `Source` directory to the "Library path" and "Browsing path". +## Unreleased Breaking Changes +Version 2 will include a change to the unit naming within the project. All units +have the `Delphi.` prefix dropped. Existing projects will need to have their +`uses` clauses updated to remove any `Delphi.` prefixes from WebMocks units. + ## Setup In your test unit file a couple of simple steps are required. 1. Add `WebMock` to your interface `uses`. @@ -338,6 +343,9 @@ Anything that can be asserted positively (`WasRequested`) can also be asserted negatively with `WasNotRequested`. This is useful to check your code is not performing extra unwanted requests. +## Semantic Versioning +This project follows [Semantic Versioning](https://semver.org). + ## License Copyright ©2019 Richard Hatherall From 4c2224406b504d7cc6bfec7ef5c9b35065849e7f Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 20 Nov 2020 09:36:57 +0000 Subject: [PATCH 06/15] Re-organize README and fix typos --- README.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 82092a9..c8d6baa 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,10 @@ Library for stubbing and setting expectations on HTTP requests in Delphi with * [DUnitX](https://github.com/VSoftTechnologies/DUnitX) * [Indy](https://www.indyproject.org) -\* Delphi-WebMocks was developed in Delphi 10.3 (Rio) and 10.4 (Sydney). -WebMocks has been reported working on 10.1 (Berlin). I'd be interested to hear -from anyone working on other versions. As Delphi-WebMocks makes use of the -`System.Net library introduced with XE8 it will not be compatible with earlier -versions. - -## Optional Dependencies -* [TestInsight](https://bitbucket.org/sglienke/testinsight/wiki/Home) is - required to run the Delphi-WebMocks test suite, so, if you're considering - contributing and need to run the test suite, install it. If you do TDD in - Delphi I would recommend installing and using it in your own projects. +\* WebMocks was developed in Delphi 10.3 (Rio) and 10.4 (Sydney). WebMocks has +been reported working on 10.1 (Berlin). I'd be interested to hear from anyone +working on other versions. As WebMocks makes use of the `System.Net` +library introduced with XE8 it will not be compatible with earlier versions. ## Installation: Delphinus-Support WebMocks should now be listed in @@ -103,13 +96,13 @@ end. ``` By default `TWebMock` will bind to a port dynamically assigned start at `8080`. -This behaviour can be overriden by sepcifying a port at creation. +This behaviour can be overriden by specifying a port at creation. ```Delphi WebMock := TWebMock.Create(8088); ``` The use of `WebMock.URLFor` function within your tests is to simplify -constructing a valid URL. The `Port` property containes the current bound port +constructing a valid URL. The `Port` property contains the current bound port and `BaseURL` property contains a valid URL for the server root. ## Examples @@ -343,6 +336,12 @@ Anything that can be asserted positively (`WasRequested`) can also be asserted negatively with `WasNotRequested`. This is useful to check your code is not performing extra unwanted requests. +## Development Dependencies (Optional) +* [TestInsight](https://bitbucket.org/sglienke/testinsight/wiki/Home) is + required to run the Delphi-WebMocks test suite, so, if you're considering + contributing and need to run the test suite, install it. If you do TDD in + Delphi I would recommend installing and using it in your own projects. + ## Semantic Versioning This project follows [Semantic Versioning](https://semver.org). From e81ffb3a7412ac36516f605b8fbaeb2653bf8005 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 20 Nov 2020 09:42:57 +0000 Subject: [PATCH 07/15] Update first example test unit --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c8d6baa..b01eab5 100644 --- a/README.md +++ b/README.md @@ -44,14 +44,14 @@ interface uses DUnitX.TestFramework, - MyTestObjectUnit, + MyObjectUnit, WebMock; type - TMyTestObjectTests = class(TObject) + TMyObjectTests = class(TObject) private WebMock: TWebMock; - Subject: TMyTestObject; + Subject: TMyObject; public [Setup] procedure Setup; @@ -63,24 +63,25 @@ type implementation -procedure TMyTestObjectTests.Setup; +procedure TMyObjectTests.Setup; begin WebMock := TWebMock.Create; end; -procedure TMyTestObjectTests.TearDown; +procedure TMyObjectTests.TearDown; begin WebMock.Free; end; -procedure TMyTestObjectTests.TestGet; +procedure TMyObjectTests.TestGet; begin // Arrange // Stub the request WebMock.StubRequest('GET', '/endpoint'); - // Point your subject at the endpoint - Subject := TMyTestObject.Create(WebMock.URLFor('endpoint')); + // Create your subject and point it at the endpoint + Subject := TMyObject.Create; + Subject.EndpointURL := WebMock.URLFor('endpoint'); // Act Subject.Get; @@ -90,8 +91,7 @@ begin end; initialization - TDUnitX.RegisterTestFixture(TMyTestObjectTests); - + TDUnitX.RegisterTestFixture(TMyObjectTests); end. ``` From f33fce785d6fac9d29b7e012aa7e6216599e07c1 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 20 Nov 2020 11:00:43 +0000 Subject: [PATCH 08/15] Add README badges --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b01eab5..4ba26f1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +![Delphi compatibility](https://img.shields.io/badge/Delphi-XE8%20or%20newer-brightgreen) +![Platform compatibility](https://img.shields.io/badge/platform-Linux64%20%7C%20macOS64%20%7C%20Win32%20%7C%20Win64-lightgrey) +![GitHub release (latest by date)](https://img.shields.io/github/v/release/appercept/Delphi-WebMocks) +![License](https://img.shields.io/github/license/appercept/Delphi-WebMocks) +![Lines of Code](https://tokei.rs/b1/github/appercept/Delphi-WebMocks) + # WebMocks Library for stubbing and setting expectations on HTTP requests in Delphi with [DUnitX](https://github.com/VSoftTechnologies/DUnitX). From ae1c21625a34319de05407dc4780a7a643a7eaa8 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 20 Nov 2020 11:06:09 +0000 Subject: [PATCH 09/15] Add release info badges --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4ba26f1..bf5ae2f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ ![Delphi compatibility](https://img.shields.io/badge/Delphi-XE8%20or%20newer-brightgreen) ![Platform compatibility](https://img.shields.io/badge/platform-Linux64%20%7C%20macOS64%20%7C%20Win32%20%7C%20Win64-lightgrey) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/appercept/Delphi-WebMocks) +![GitHub Release Date](https://img.shields.io/github/release-date/appercept/Delphi-WebMocks) +![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/appercept/Delphi-WebMocks/latest?sort=semver) ![License](https://img.shields.io/github/license/appercept/Delphi-WebMocks) ![Lines of Code](https://tokei.rs/b1/github/appercept/Delphi-WebMocks) From 5f6022c4710330e5e836a4bcba28c9a77f9f7168 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 20 Nov 2020 11:10:20 +0000 Subject: [PATCH 10/15] Re-arrange badges --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bf5ae2f..90c9f55 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ ![Delphi compatibility](https://img.shields.io/badge/Delphi-XE8%20or%20newer-brightgreen) ![Platform compatibility](https://img.shields.io/badge/platform-Linux64%20%7C%20macOS64%20%7C%20Win32%20%7C%20Win64-lightgrey) +![License](https://img.shields.io/github/license/appercept/Delphi-WebMocks) + ![GitHub release (latest by date)](https://img.shields.io/github/v/release/appercept/Delphi-WebMocks) ![GitHub Release Date](https://img.shields.io/github/release-date/appercept/Delphi-WebMocks) ![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/appercept/Delphi-WebMocks/latest?sort=semver) -![License](https://img.shields.io/github/license/appercept/Delphi-WebMocks) ![Lines of Code](https://tokei.rs/b1/github/appercept/Delphi-WebMocks) # WebMocks From fbe1ab97ee6ac200e60a2d8fa952c5d3cb060d0e Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 20 Nov 2020 11:15:48 +0000 Subject: [PATCH 11/15] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 90c9f55..787ccf4 100644 --- a/README.md +++ b/README.md @@ -355,6 +355,8 @@ performing extra unwanted requests. This project follows [Semantic Versioning](https://semver.org). ## License -Copyright ©2019 Richard Hatherall +Copyright ©2019-2020 Richard Hatherall + +WebMocks is distributed under the terms of the Apache License (Version 2.0). See [LICENSE](LICENSE) for details. From 0c1358fb464967045ea7c3335300c523b133b77c Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Fri, 20 Nov 2020 11:41:32 +0000 Subject: [PATCH 12/15] Update README.md --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 787ccf4..de4d6f4 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,9 @@ ![Delphi compatibility](https://img.shields.io/badge/Delphi-XE8%20or%20newer-brightgreen) ![Platform compatibility](https://img.shields.io/badge/platform-Linux64%20%7C%20macOS64%20%7C%20Win32%20%7C%20Win64-lightgrey) ![License](https://img.shields.io/github/license/appercept/Delphi-WebMocks) - -![GitHub release (latest by date)](https://img.shields.io/github/v/release/appercept/Delphi-WebMocks) -![GitHub Release Date](https://img.shields.io/github/release-date/appercept/Delphi-WebMocks) -![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/appercept/Delphi-WebMocks/latest?sort=semver) ![Lines of Code](https://tokei.rs/b1/github/appercept/Delphi-WebMocks) -# WebMocks +# WebMocks ![GitHub release (latest by date)](https://img.shields.io/github/v/release/appercept/Delphi-WebMocks) ![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/appercept/Delphi-WebMocks/latest?sort=semver) ![GitHub Release Date](https://img.shields.io/github/release-date/appercept/Delphi-WebMocks) Library for stubbing and setting expectations on HTTP requests in Delphi with [DUnitX](https://github.com/VSoftTechnologies/DUnitX). From 1f63ed69ff92b3e9e791a7f999d5f02b57f778c4 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Sat, 21 Nov 2020 13:45:47 +0000 Subject: [PATCH 13/15] Add support for dynamic responses Resolves #16. It is now possible to create responses dynamically. This enables greater customisation on a per-request basis. For example: ```Delphi WebMock.StubRequest('*', '*') .ToRespondWith( procedure (const ARequest: IWebMockHTTPRequest; const AResponse: IWebMockResponseBuilder) begin AReponse .WithStatus(202) .WithHeader('header-1', 'a-value') .WithBody('Some content...'); end ); ``` The `ARequest: IWebMockHTTPRequest` parameter is available for inspection. The internals have been updated to introduce a "responder" layer allowing different handlers for responses which should be useful beyond this change. --- README.md | 47 ++++ Source/WebMock.Dynamic.RequestStub.pas | 41 ++- Source/WebMock.Dynamic.Responder.pas | 70 ++++++ Source/WebMock.HTTP.Request.pas | 5 +- Source/WebMock.HTTP.RequestMatcher.pas | 106 +++++++- Source/WebMock.RequestStub.pas | 11 +- Source/WebMock.Responder.pas | 42 ++++ Source/WebMock.Response.pas | 100 ++++++-- Source/WebMock.Static.RequestStub.pas | 50 ++-- Source/WebMock.Static.Responder.pas | 64 +++++ Source/WebMock.pas | 25 +- .../WebMock.DynamicResponses.Tests.pas | 114 +++++++++ Tests/WebMock.Dynamic.RequestStub.Tests.pas | 36 +-- Tests/WebMock.Dynamic.Responder.Tests.pas | 137 ++++++++++ Tests/WebMock.HTTP.RequestMatcher.Tests.pas | 10 +- Tests/WebMock.Response.Tests.pas | 130 +--------- Tests/WebMock.ResponseBuilder.Tests.pas | 234 ++++++++++++++++++ Tests/WebMock.Static.RequestStub.Tests.pas | 22 +- Tests/WebMock.Static.Responder.Tests.pas | 65 +++++ Tests/WebMocks.Tests.dpr | 9 +- Tests/WebMocks.Tests.dproj | 13 + 21 files changed, 1097 insertions(+), 234 deletions(-) create mode 100644 Source/WebMock.Dynamic.Responder.pas create mode 100644 Source/WebMock.Responder.pas create mode 100644 Source/WebMock.Static.Responder.pas create mode 100644 Tests/Features/WebMock.DynamicResponses.Tests.pas create mode 100644 Tests/WebMock.Dynamic.Responder.Tests.pas create mode 100644 Tests/WebMock.ResponseBuilder.Tests.pas create mode 100644 Tests/WebMock.Static.Responder.Tests.pas diff --git a/README.md b/README.md index de4d6f4..a12ee58 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,53 @@ compiler will be output to the `Win32\Debug` folder. To correctly reference a file named `Content.txt` in the project folder, the path will be `..\..\Content.txt`. +#### Dynamic Responses +Sometimes it is useful to dynamically respond to a request. For example: +```Delphi +WebMock.StubRequest('*', '*') + .ToRespondWith( + procedure (const ARequest: IWebMockHTTPRequest; + const AResponse: IWebMockResponseBuilder) + begin + AReponse + .WithStatus(202) + .WithHeader('header-1', 'a-value') + .WithBody('Some content...'); + end + ); +``` + +This enables testing of features that require deeper inspection of the request +or to reflect values from the request back in the response. For example: +```Delphi +WebMock.StubRequest('GET', '/echo_header') + .ToRespondWith( + procedure (const ARequest: IWebMockHTTPRequest; + const AResponse: IWebMockHTTPResponseBuilder) + begin + AResponse.WithHeader('my-header', ARequest.Headers.Values['my-header']); + end + ); +``` + +It can also be useful for simulating failures for a number of attempts before +returning a success. For example: +```Delphi +var LRequestCount := 0; +WebMock.StubRequest('GET', '/busy_endpoint') + .ToRespondWith( + procedure (const ARequest: IWebMockHTTPRequest; + const AResponse: IWebMockHTTPResponseBuilder) + begin + Inc(LRequestCount); + if LRequestCount < 3 then + AResponse.WithStatus(408, 'Request Timeout') + else + AResponse.WithStatus(200, 'OK'); + end + ); +``` + ### Resetting Registered Stubs If you need to clear the current registered stubs you can call `ResetStubRegistry` or `Reset` on the instance of TWebMock. The general `Reset` diff --git a/Source/WebMock.Dynamic.RequestStub.pas b/Source/WebMock.Dynamic.RequestStub.pas index bb5e6cf..38789f5 100644 --- a/Source/WebMock.Dynamic.RequestStub.pas +++ b/Source/WebMock.Dynamic.RequestStub.pas @@ -28,7 +28,11 @@ interface uses - WebMock.HTTP.Messages, WebMock.RequestStub, WebMock.Response, + WebMock.Dynamic.Responder, + WebMock.HTTP.Messages, + WebMock.RequestStub, + WebMock.Responder, + WebMock.Response, WebMock.ResponseStatus; type @@ -39,18 +43,21 @@ interface TWebMockDynamicRequestStub = class(TInterfacedObject, IWebMockRequestStub) private FMatcher: TWebMockDynamicRequestMatcher; + FResponder: IWebMockResponder; FResponse: TWebMockResponse; + property Response: TWebMockResponse read FResponse; public constructor Create(const AMatcher: TWebMockDynamicRequestMatcher); function ToRespond(AResponseStatus: TWebMockResponseStatus = nil) - : TWebMockResponse; + : IWebMockResponseBuilder; + procedure ToRespondWith(const AProc: TWebMockDynamicResponse); - // IWebMockRequestStub + { IWebMockRequestStub } function IsMatch(ARequest: IWebMockHTTPRequest): Boolean; - function GetResponse: TWebMockResponse; - procedure SetResponse(const AResponse: TWebMockResponse); + function GetResponder: IWebMockResponder; + procedure SetResponder(const AResponder: IWebMockResponder); function ToString: string; override; - property Response: TWebMockResponse read GetResponse write SetResponse; + property Responder: IWebMockResponder read GetResponder write SetResponder; property Matcher: TWebMockDynamicRequestMatcher read FMatcher; end; @@ -58,7 +65,8 @@ TWebMockDynamicRequestStub = class(TInterfacedObject, IWebMockRequestStub) implementation uses - System.SysUtils; + System.SysUtils, + WebMock.Static.Responder; { TWebMockDynamicRequestStub } @@ -68,11 +76,12 @@ constructor TWebMockDynamicRequestStub.Create( inherited Create; FMatcher := AMatcher; FResponse := TWebMockResponse.Create; + FResponder := TWebMockStaticResponder.Create(FResponse) end; -function TWebMockDynamicRequestStub.GetResponse: TWebMockResponse; +function TWebMockDynamicRequestStub.GetResponder: IWebMockResponder; begin - Result := FResponse; + Result := FResponder; end; function TWebMockDynamicRequestStub.IsMatch( @@ -81,14 +90,14 @@ function TWebMockDynamicRequestStub.IsMatch( Result := Matcher(ARequest); end; -procedure TWebMockDynamicRequestStub.SetResponse( - const AResponse: TWebMockResponse); +procedure TWebMockDynamicRequestStub.SetResponder( + const AResponder: IWebMockResponder); begin - FResponse := AResponse; + FResponder := AResponder; end; function TWebMockDynamicRequestStub.ToRespond( - AResponseStatus: TWebMockResponseStatus): TWebMockResponse; + AResponseStatus: TWebMockResponseStatus): IWebMockResponseBuilder; begin if Assigned(AResponseStatus) then Response.Status := AResponseStatus; @@ -96,6 +105,12 @@ function TWebMockDynamicRequestStub.ToRespond( Result := Response; end; +procedure TWebMockDynamicRequestStub.ToRespondWith( + const AProc: TWebMockDynamicResponse); +begin + Responder := TWebMockDynamicResponder.Create(AProc); +end; + function TWebMockDynamicRequestStub.ToString: string; begin Result := Format('(Dynamic Matcher)' + ^I + '%s', [Response.ToString]); diff --git a/Source/WebMock.Dynamic.Responder.pas b/Source/WebMock.Dynamic.Responder.pas new file mode 100644 index 0000000..410c57a --- /dev/null +++ b/Source/WebMock.Dynamic.Responder.pas @@ -0,0 +1,70 @@ +{******************************************************************************} +{ } +{ Delphi-WebMocks } +{ } +{ Copyright (c) 2020 Richard Hatherall } +{ } +{ richard@appercept.com } +{ https://appercept.com } +{ } +{******************************************************************************} +{ } +{ Licensed under the Apache License, Version 2.0 (the "License"); } +{ you may not use this file except in compliance with the License. } +{ You may obtain a copy of the License at } +{ } +{ http://www.apache.org/licenses/LICENSE-2.0 } +{ } +{ Unless required by applicable law or agreed to in writing, software } +{ distributed under the License is distributed on an "AS IS" BASIS, } +{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } +{ See the License for the specific language governing permissions and } +{ limitations under the License. } +{ } +{******************************************************************************} + +unit WebMock.Dynamic.Responder; + +interface + +uses + WebMock.HTTP.Messages, + WebMock.Responder, + WebMock.Response; + +type + TWebMockDynamicResponse = reference to procedure ( + const ARequest: IWebMockHTTPRequest; + const AResponse: IWebMockResponseBuilder + ); + + TWebMockDynamicResponder = class(TInterfacedObject, IWebMockResponder) + private + FProc: TWebMockDynamicResponse; + public + constructor Create(const AProc: TWebMockDynamicResponse); + function GetResponseTo(const ARequest: IWebMockHTTPRequest): TWebMockResponse; + end; + +implementation + +{ TWebMockDynamicResponder } + +constructor TWebMockDynamicResponder.Create( + const AProc: TWebMockDynamicResponse); +begin + inherited Create; + FProc := AProc; +end; + +function TWebMockDynamicResponder.GetResponseTo( + const ARequest: IWebMockHTTPRequest): TWebMockResponse; +var + LResponse: TWebMockResponse; +begin + LResponse := TWebMockResponse.Create; + FProc(ARequest, LResponse); + Result := LResponse; +end; + +end. diff --git a/Source/WebMock.HTTP.Request.pas b/Source/WebMock.HTTP.Request.pas index 8724708..8b42174 100644 --- a/Source/WebMock.HTTP.Request.pas +++ b/Source/WebMock.HTTP.Request.pas @@ -2,7 +2,7 @@ { } { Delphi-WebMocks } { } -{ Copyright (c) 2019 Richard Hatherall } +{ Copyright (c) 2019-2020 Richard Hatherall } { } { richard@appercept.com } { https://appercept.com } @@ -28,7 +28,8 @@ interface uses - IdCustomHTTPServer, IdHeaderList, + IdCustomHTTPServer, + IdHeaderList, System.Classes, WebMock.HTTP.Messages; diff --git a/Source/WebMock.HTTP.RequestMatcher.pas b/Source/WebMock.HTTP.RequestMatcher.pas index 59c8914..b0833ae 100644 --- a/Source/WebMock.HTTP.RequestMatcher.pas +++ b/Source/WebMock.HTTP.RequestMatcher.pas @@ -2,7 +2,7 @@ { } { Delphi-WebMocks } { } -{ Copyright (c) 2019 Richard Hatherall } +{ Copyright (c) 2019-2020 Richard Hatherall } { } { richard@appercept.com } { https://appercept.com } @@ -28,17 +28,48 @@ interface uses - IdCustomHTTPServer, IdHeaderList, - System.Classes, System.Generics.Collections, System.RegularExpressions, - WebMock.HTTP.Messages, WebMock.StringMatcher; + IdCustomHTTPServer, + IdHeaderList, + System.Classes, + System.Generics.Collections, + System.RegularExpressions, + WebMock.HTTP.Messages, + WebMock.StringMatcher; type - TWebMockHTTPRequestMatcher = class(TObject) + IWebMockHTTPRequestMatcherBuilder = interface(IInterface) + ['{47AE1CA8-9395-4B80-AD6F-5F0A7017ED7D}'] + function WithBody(const AContent: string): IWebMockHTTPRequestMatcherBuilder; overload; + function WithBody(const APattern: TRegEx): IWebMockHTTPRequestMatcherBuilder; overload; + function WithHeader(const AName, AValue: string): IWebMockHTTPRequestMatcherBuilder; overload; + function WithHeader(const AName: string; APattern: TRegEx): IWebMockHTTPRequestMatcherBuilder; overload; + function WithHeaders(const AHeaders: TStrings): IWebMockHTTPRequestMatcherBuilder; + end; + + TWebMockHTTPRequestMatcher = class(TInterfacedObject, IWebMockHTTPRequestMatcherBuilder) + public type + + TBuilder = class(TInterfacedObject, IWebMockHTTPRequestMatcherBuilder) + private + FMatcher: TWebMockHTTPRequestMatcher; + property Matcher: TWebMockHTTPRequestMatcher read FMatcher; + public + constructor Create(const AMatcher: TWebMockHTTPRequestMatcher); + + { IWebMockHTTPRequestMatcherBuilder } + function WithBody(const AContent: string): IWebMockHTTPRequestMatcherBuilder; overload; + function WithBody(const APattern: TRegEx): IWebMockHTTPRequestMatcherBuilder; overload; + function WithHeader(const AName, AValue: string): IWebMockHTTPRequestMatcherBuilder; overload; + function WithHeader(const AName: string; APattern: TRegEx): IWebMockHTTPRequestMatcherBuilder; overload; + function WithHeaders(const AHeaders: TStrings): IWebMockHTTPRequestMatcherBuilder; + end; + private FContent: IStringMatcher; FHeaders: TDictionary; FHTTPMethod: string; FURIMatcher: IStringMatcher; + FBuilder: TBuilder; function HeadersMatches( AHeaders: TStrings): Boolean; function HTTPMethodMatches(AHTTPMethod: string): Boolean; @@ -50,6 +81,7 @@ TWebMockHTTPRequestMatcher = class(TObject) function IsMatch(ARequest: IWebMockHTTPRequest): Boolean; function ToString: string; override; property Body: IStringMatcher read FContent write FContent; + property Builder: TBuilder read FBuilder implements IWebMockHTTPRequestMatcherBuilder; property Headers: TDictionary read FHeaders; property HTTPMethod: string read FHTTPMethod write FHTTPMethod; property URIMatcher: IStringMatcher read FURIMatcher; @@ -61,13 +93,15 @@ implementation uses System.SysUtils, - WebMock.StringWildcardMatcher, WebMock.StringAnyMatcher, + WebMock.StringWildcardMatcher, + WebMock.StringAnyMatcher, WebMock.StringRegExMatcher; constructor TWebMockHTTPRequestMatcher.Create(AURI: string; AHTTPMethod: string = 'GET'); begin inherited Create; + FBuilder := TBuilder.Create(Self); FContent := TWebMockStringAnyMatcher.Create; FHeaders := TDictionary.Create; FURIMatcher := TWebMockStringWildcardMatcher.Create(AURI); @@ -78,6 +112,7 @@ constructor TWebMockHTTPRequestMatcher.Create(AURIPattern: TRegEx; AHTTPMethod: string = 'GET'); begin inherited Create; + FBuilder := TBuilder.Create(Self); FContent := TWebMockStringAnyMatcher.Create; FHeaders := TDictionary.Create; FURIMatcher := TWebMockStringRegExMatcher.Create(AURIPattern); @@ -145,4 +180,63 @@ function TWebMockHTTPRequestMatcher.ToString: string; Result := Format('%s' + ^I + '%s', [HTTPMethod, URIMatcher.ToString]); end; +{ TWebMockHTTPRequestMatcher.TBuilder } + +function TWebMockHTTPRequestMatcher.TBuilder.WithBody( + const AContent: string): IWebMockHTTPRequestMatcherBuilder; +begin + Matcher.Body := TWebMockStringWildcardMatcher.Create(AContent); + + Result := Self; +end; + +constructor TWebMockHTTPRequestMatcher.TBuilder.Create( + const AMatcher: TWebMockHTTPRequestMatcher); +begin + inherited Create; + FMatcher := AMatcher; +end; + +function TWebMockHTTPRequestMatcher.TBuilder.WithBody( + const APattern: TRegEx): IWebMockHTTPRequestMatcherBuilder; +begin + Matcher.Body := TWebMockStringRegExMatcher.Create(APattern); + + Result := Self; +end; + +function TWebMockHTTPRequestMatcher.TBuilder.WithHeader(const AName, + AValue: string): IWebMockHTTPRequestMatcherBuilder; +begin + Matcher.Headers.AddOrSetValue( + AName, + TWebMockStringWildcardMatcher.Create(AValue) + ); + + Result := Self; +end; + +function TWebMockHTTPRequestMatcher.TBuilder.WithHeader(const AName: string; + APattern: TRegEx): IWebMockHTTPRequestMatcherBuilder; +begin + Matcher.Headers.AddOrSetValue( + AName, + TWebMockStringRegExMatcher.Create(APattern) + ); + + Result := Self; +end; + + +function TWebMockHTTPRequestMatcher.TBuilder.WithHeaders( + const AHeaders: TStrings): IWebMockHTTPRequestMatcherBuilder; +var + I: Integer; +begin + for I := 0 to AHeaders.Count - 1 do + WithHeader(AHeaders.Names[I], AHeaders.ValueFromIndex[I]); + + Result := Self; +end; + end. diff --git a/Source/WebMock.RequestStub.pas b/Source/WebMock.RequestStub.pas index b9e3245..5e18d80 100644 --- a/Source/WebMock.RequestStub.pas +++ b/Source/WebMock.RequestStub.pas @@ -29,16 +29,19 @@ interface uses System.Classes, - WebMock.HTTP.Messages, WebMock.Response; + System.Net.HttpClient, + WebMock.HTTP.Messages, + WebMock.Responder, + WebMock.Response; type IWebMockRequestStub = interface(IInterface) ['{AA474C0C-CA37-44CF-A66A-3B024CC79BE6}'] function IsMatch(ARequest: IWebMockHTTPRequest): Boolean; - function GetResponse: TWebMockResponse; - procedure SetResponse(const AResponse: TWebMockResponse); + function GetResponder: IWebMockResponder; + procedure SetResponder(const AResponder: IWebMockResponder); function ToString: string; - property Response: TWebMockResponse read GetResponse write SetResponse; + property Responder: IWebMockResponder read GetResponder write SetResponder; end; implementation diff --git a/Source/WebMock.Responder.pas b/Source/WebMock.Responder.pas new file mode 100644 index 0000000..81cb5dc --- /dev/null +++ b/Source/WebMock.Responder.pas @@ -0,0 +1,42 @@ +{******************************************************************************} +{ } +{ Delphi-WebMocks } +{ } +{ Copyright (c) 2020 Richard Hatherall } +{ } +{ richard@appercept.com } +{ https://appercept.com } +{ } +{******************************************************************************} +{ } +{ Licensed under the Apache License, Version 2.0 (the "License"); } +{ you may not use this file except in compliance with the License. } +{ You may obtain a copy of the License at } +{ } +{ http://www.apache.org/licenses/LICENSE-2.0 } +{ } +{ Unless required by applicable law or agreed to in writing, software } +{ distributed under the License is distributed on an "AS IS" BASIS, } +{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } +{ See the License for the specific language governing permissions and } +{ limitations under the License. } +{ } +{******************************************************************************} + +unit WebMock.Responder; + +interface + +uses + WebMock.HTTP.Messages, + WebMock.Response; + +type + IWebMockResponder = interface(IInterface) + ['{DC0BF955-CBFB-4EBB-987B-0A5FCE2C6575}'] + function GetResponseTo(const ARequest: IWebMockHTTPRequest): TWebMockResponse; + end; + +implementation + +end. diff --git a/Source/WebMock.Response.pas b/Source/WebMock.Response.pas index 2815b71..9536594 100644 --- a/Source/WebMock.Response.pas +++ b/Source/WebMock.Response.pas @@ -2,7 +2,7 @@ { } { Delphi-WebMocks } { } -{ Copyright (c) 2019 Richard Hatherall } +{ Copyright (c) 2019-2020 Richard Hatherall } { } { richard@appercept.com } { https://appercept.com } @@ -29,11 +29,44 @@ interface uses System.Classes, - WebMock.ResponseBodySource, WebMock.ResponseStatus; + WebMock.HTTP.Messages, + WebMock.ResponseBodySource, + WebMock.ResponseStatus; type - TWebMockResponse = class(TObject) + IWebMockResponseBuilder = interface(IInterface) + ['{7F071795-E710-44B6-B799-4BE03ADC954F}'] + function WithBody(const AContent: string; + const AContentType: string = 'text/plain; charset=utf-8'): IWebMockResponseBuilder; + function WithBodyFile(const AFileName: string; + const AContentType: string = ''): IWebMockResponseBuilder; + function WithHeader(const AHeaderName, AHeaderValue: string): IWebMockResponseBuilder; + function WithHeaders(const AHeaders: TStrings): IWebMockResponseBuilder; + function WithStatus(const AStatus: TWebMockResponseStatus): IWebMockResponseBuilder; overload; + function WithStatus(const AStatusCode: Integer; const AStatusText: string = ''): IWebMockResponseBuilder; overload; + end; + + TWebMockResponse = class(TInterfacedObject, IWebMockResponseBuilder) + private type + + TBuilder = class(TInterfacedObject, IWebMockResponseBuilder) + private + FResponse: TWebMockResponse; + public + constructor Create(const AResponse: TWebMockResponse); + function WithBody(const AContent: string; + const AContentType: string = 'text/plain; charset=utf-8'): IWebMockResponseBuilder; + function WithBodyFile(const AFileName: string; + const AContentType: string = ''): IWebMockResponseBuilder; + function WithHeader(const AHeaderName, AHeaderValue: string): IWebMockResponseBuilder; + function WithHeaders(const AHeaders: TStrings): IWebMockResponseBuilder; + function WithStatus(const AStatus: TWebMockResponseStatus): IWebMockResponseBuilder; overload; + function WithStatus(const AStatusCode: Integer; const AStatusText: string = ''): IWebMockResponseBuilder; overload; + property Response: TWebMockResponse read FResponse; + end; + private + FBuilder: IWebMockResponseBuilder; FBodySource: IWebMockResponseBodySource; FHeaders: TStringList; FStatus: TWebMockResponseStatus; @@ -41,12 +74,7 @@ TWebMockResponse = class(TObject) constructor Create(const AStatus: TWebMockResponseStatus = nil); destructor Destroy; override; function ToString: string; override; - function WithBody(const AContent: string; - const AContentType: string = 'text/plain; charset=utf-8'): TWebMockResponse; - function WithBodyFile(const AFileName: string; - const AContentType: string = ''): TWebMockResponse; - function WithHeader(AHeaderName, AHeaderValue: string): TWebMockResponse; - function WithHeaders(AHeaders: TStrings): TWebMockResponse; + property Builder: IWebMockResponseBuilder read FBuilder implements IWebMockResponseBuilder; property BodySource: IWebMockResponseBodySource read FBodySource write FBodySource; property Headers: TStringList read FHeaders write FHeaders; property Status: TWebMockResponseStatus read FStatus write FStatus; @@ -58,12 +86,14 @@ implementation uses System.SysUtils, - WebMock.ResponseContentFile, WebMock.ResponseContentString; + WebMock.ResponseContentFile, + WebMock.ResponseContentString; constructor TWebMockResponse.Create(const AStatus : TWebMockResponseStatus = nil); begin inherited Create; + FBuilder := TBuilder.Create(Self); FBodySource := TWebMockResponseContentString.Create; FHeaders := TStringList.Create; if Assigned(AStatus) then @@ -84,33 +114,61 @@ function TWebMockResponse.ToString: string; Result := Format('%s', [Status.ToString]); end; -function TWebMockResponse.WithBody(const AContent: string; - const AContentType: string = 'text/plain; charset=utf-8'): TWebMockResponse; +{ TWebMockResponse.TBuilder } + +constructor TWebMockResponse.TBuilder.Create(const AResponse: TWebMockResponse); +begin + inherited Create; + FResponse := AResponse; +end; + +function TWebMockResponse.TBuilder.WithBody(const AContent, + AContentType: string): IWebMockResponseBuilder; begin - BodySource := TWebMockResponseContentString.Create(AContent, AContentType); + Response.BodySource := TWebMockResponseContentString.Create(AContent, AContentType); Result := Self; end; -function TWebMockResponse.WithBodyFile(const AFileName: string; - const AContentType: string = ''): TWebMockResponse; + +function TWebMockResponse.TBuilder.WithBodyFile(const AFileName, + AContentType: string): IWebMockResponseBuilder; +begin + Response.BodySource := TWebMockResponseContentFile.Create(AFileName, AContentType); + + Result := Self; +end; + + +function TWebMockResponse.TBuilder.WithHeader(const AHeaderName, + AHeaderValue: string): IWebMockResponseBuilder; +begin + Response.Headers.Values[AHeaderName] := AHeaderValue; + + Result := Self; +end; + + +function TWebMockResponse.TBuilder.WithHeaders( + const AHeaders: TStrings): IWebMockResponseBuilder; begin - BodySource := TWebMockResponseContentFile.Create(AFileName, AContentType); + Response.Headers.AddStrings(AHeaders); Result := Self; end; -function TWebMockResponse.WithHeader(AHeaderName, - AHeaderValue: string): TWebMockResponse; +function TWebMockResponse.TBuilder.WithStatus(const AStatusCode: Integer; + const AStatusText: string = ''): IWebMockResponseBuilder; begin - Headers.Values[AHeaderName] := AHeaderValue; + Response.Status := TWebMockResponseStatus.Create(AStatusCode, AStatusText); Result := Self; end; -function TWebMockResponse.WithHeaders(AHeaders: TStrings): TWebMockResponse; +function TWebMockResponse.TBuilder.WithStatus( + const AStatus: TWebMockResponseStatus): IWebMockResponseBuilder; begin - Headers.AddStrings(AHeaders); + Response.Status := AStatus; Result := Self; end; diff --git a/Source/WebMock.Static.RequestStub.pas b/Source/WebMock.Static.RequestStub.pas index b06db20..f19e9e5 100644 --- a/Source/WebMock.Static.RequestStub.pas +++ b/Source/WebMock.Static.RequestStub.pas @@ -29,20 +29,31 @@ interface uses IdCustomHTTPServer, - System.Classes, System.Generics.Collections, System.RegularExpressions, - WebMock.HTTP.Messages, WebMock.HTTP.RequestMatcher, WebMock.RequestStub, - WebMock.Response, WebMock.ResponseStatus; + System.Classes, + System.Generics.Collections, + System.RegularExpressions, + WebMock.Dynamic.Responder, + WebMock.HTTP.Messages, + WebMock.HTTP.RequestMatcher, + WebMock.RequestStub, + WebMock.Responder, + WebMock.Response, + WebMock.ResponseStatus; type TWebMockStaticRequestStub = class(TInterfacedObject, IWebMockRequestStub) private FMatcher: TWebMockHTTPRequestMatcher; + FResponder: IWebMockResponder; FResponse: TWebMockResponse; + property Response: TWebMockResponse read FResponse; public constructor Create(AMatcher: TWebMockHTTPRequestMatcher); destructor Destroy; override; function ToRespond(AResponseStatus: TWebMockResponseStatus = nil) - : TWebMockResponse; + : IWebMockResponseBuilder; + procedure ToRespondWith(const AProc: TWebMockDynamicResponse); + function WithBody(const AContent: string): TWebMockStaticRequestStub; overload; function WithBody(const APattern: TRegEx): TWebMockStaticRequestStub; overload; function WithHeader(AName, AValue: string): TWebMockStaticRequestStub; overload; @@ -52,10 +63,10 @@ TWebMockStaticRequestStub = class(TInterfacedObject, IWebMockRequestStub) // IWebMockRequestStub function IsMatch(ARequest: IWebMockHTTPRequest): Boolean; - function GetResponse: TWebMockResponse; - procedure SetResponse(const AResponse: TWebMockResponse); + function GetResponder: IWebMockResponder; + procedure SetResponder(const AResponder: IWebMockResponder); function ToString: string; override; - property Response: TWebMockResponse read GetResponse write SetResponse; + property Responder: IWebMockResponder read GetResponder write SetResponder; property Matcher: TWebMockHTTPRequestMatcher read FMatcher; end; @@ -64,7 +75,9 @@ implementation uses System.SysUtils, - WebMock.StringWildcardMatcher, WebMock.StringRegExMatcher; + WebMock.Static.Responder, + WebMock.StringWildcardMatcher, + WebMock.StringRegExMatcher; { TWebMockRequestStub } @@ -73,6 +86,7 @@ constructor TWebMockStaticRequestStub.Create(AMatcher: TWebMockHTTPRequestMatche inherited Create; FMatcher := AMatcher; FResponse := TWebMockResponse.Create; + FResponder := TWebMockStaticResponder.Create(Response); end; destructor TWebMockStaticRequestStub.Destroy; @@ -83,9 +97,9 @@ destructor TWebMockStaticRequestStub.Destroy; inherited; end; -function TWebMockStaticRequestStub.GetResponse: TWebMockResponse; +function TWebMockStaticRequestStub.GetResponder: IWebMockResponder; begin - Result := FResponse; + Result := FResponder; end; function TWebMockStaticRequestStub.IsMatch( @@ -94,19 +108,25 @@ function TWebMockStaticRequestStub.IsMatch( Result := Matcher.IsMatch(ARequest); end; -procedure TWebMockStaticRequestStub.SetResponse( - const AResponse: TWebMockResponse); +procedure TWebMockStaticRequestStub.SetResponder( + const AResponder: IWebMockResponder); begin - + FResponder := AResponder; end; function TWebMockStaticRequestStub.ToRespond( - AResponseStatus: TWebMockResponseStatus = nil): TWebMockResponse; + AResponseStatus: TWebMockResponseStatus = nil): IWebMockResponseBuilder; begin if Assigned(AResponseStatus) then Response.Status := AResponseStatus; - Result := Response; + Result := Response as IWebMockResponseBuilder; +end; + +procedure TWebMockStaticRequestStub.ToRespondWith( + const AProc: TWebMockDynamicResponse); +begin + Responder := TWebMockDynamicResponder.Create(AProc); end; function TWebMockStaticRequestStub.ToString: string; diff --git a/Source/WebMock.Static.Responder.pas b/Source/WebMock.Static.Responder.pas new file mode 100644 index 0000000..7100f32 --- /dev/null +++ b/Source/WebMock.Static.Responder.pas @@ -0,0 +1,64 @@ +{******************************************************************************} +{ } +{ Delphi-WebMocks } +{ } +{ Copyright (c) 2020 Richard Hatherall } +{ } +{ richard@appercept.com } +{ https://appercept.com } +{ } +{******************************************************************************} +{ } +{ Licensed under the Apache License, Version 2.0 (the "License"); } +{ you may not use this file except in compliance with the License. } +{ You may obtain a copy of the License at } +{ } +{ http://www.apache.org/licenses/LICENSE-2.0 } +{ } +{ Unless required by applicable law or agreed to in writing, software } +{ distributed under the License is distributed on an "AS IS" BASIS, } +{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } +{ See the License for the specific language governing permissions and } +{ limitations under the License. } +{ } +{******************************************************************************} + +unit WebMock.Static.Responder; + +interface + +uses + WebMock.HTTP.Messages, + WebMock.Responder, + WebMock.Response; + +type + TWebMockStaticResponder = class(TInterfacedObject, IWebMockResponder) + private + FResponse: TWebMockResponse; + public + constructor Create(const AResponse: TWebMockResponse); + + { IWebMockResponder } + function GetResponseTo(const ARequest: IWebMockHTTPRequest): TWebMockResponse; + + property Response: TWebMockResponse read FResponse; + end; + +implementation + +{ TWebMockStaticResponder } + +constructor TWebMockStaticResponder.Create(const AResponse: TWebMockResponse); +begin + inherited Create; + FResponse := AResponse; +end; + +function TWebMockStaticResponder.GetResponseTo( + const ARequest: IWebMockHTTPRequest): TWebMockResponse; +begin + Result := FResponse; +end; + +end. diff --git a/Source/WebMock.pas b/Source/WebMock.pas index 139a533..0d5b55d 100644 --- a/Source/WebMock.pas +++ b/Source/WebMock.pas @@ -28,12 +28,22 @@ interface uses - IdContext, IdCustomHTTPServer, IdGlobal, IdHTTPServer, - System.Classes, System.Generics.Collections, System.RegularExpressions, + IdContext, + IdCustomHTTPServer, + IdGlobal, + IdHTTPServer, + System.Classes, + System.Generics.Collections, + System.RegularExpressions, System.SysUtils, - WebMock.Assertion, WebMock.HTTP.Messages, WebMock.RequestStub, - WebMock.Static.RequestStub, WebMock.Dynamic.RequestStub, WebMock.Response, - WebMock.ResponseBodySource, WebMock.ResponseStatus; + WebMock.Assertion, + WebMock.HTTP.Messages, + WebMock.RequestStub, + WebMock.Static.RequestStub, + WebMock.Dynamic.RequestStub, + WebMock.Response, + WebMock.ResponseBodySource, + WebMock.ResponseStatus; type EWebMockError = class(Exception); @@ -181,7 +191,10 @@ procedure TWebMock.OnServerRequest(AContext: TIdContext; History.Add(LRequest); LRequestStub := GetRequestStub(LRequest); if Assigned(LRequestStub) then - RespondWith(LRequestStub.Response, AResponseInfo) + RespondWith( + LRequestStub.Responder.GetResponseTo(LRequest), + AResponseInfo + ) else SetResponseStatus(AResponseInfo, TWebMockResponseStatus.NotImplemented); end; diff --git a/Tests/Features/WebMock.DynamicResponses.Tests.pas b/Tests/Features/WebMock.DynamicResponses.Tests.pas new file mode 100644 index 0000000..346c8ea --- /dev/null +++ b/Tests/Features/WebMock.DynamicResponses.Tests.pas @@ -0,0 +1,114 @@ +{******************************************************************************} +{ } +{ Delphi-WebMocks } +{ } +{ Copyright (c) 2020 Richard Hatherall } +{ } +{ richard@appercept.com } +{ https://appercept.com } +{ } +{******************************************************************************} +{ } +{ Licensed under the Apache License, Version 2.0 (the "License"); } +{ you may not use this file except in compliance with the License. } +{ You may obtain a copy of the License at } +{ } +{ http://www.apache.org/licenses/LICENSE-2.0 } +{ } +{ Unless required by applicable law or agreed to in writing, software } +{ distributed under the License is distributed on an "AS IS" BASIS, } +{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } +{ See the License for the specific language governing permissions and } +{ limitations under the License. } +{ } +{******************************************************************************} + +unit WebMock.DynamicResponses.Tests; + +interface + +uses + DUnitX.TestFramework, + WebMock; + +type + [TestFixture] + TWebMockDynamicResponsesTests = class(TObject) + private + WebMock: TWebMock; + public + [Setup] + procedure Setup; + [TearDown] + procedure TearDown; + [Test] + procedure DynamicResponse_WithStaticMatcher_ReceivesRequest; + [Test] + procedure DynamicResponse_WithDynamicMatcher_ReceivesRequest; + end; + +implementation + +uses + System.Net.HttpClient, + TestHelpers, + WebMock.HTTP.Messages, + WebMock.Response; + +{ TWebMockDynamicResponsesTests } + +procedure TWebMockDynamicResponsesTests.DynamicResponse_WithDynamicMatcher_ReceivesRequest; +var + LResponse: IHTTPResponse; +begin + WebMock.StubRequest( + function(ARequest: IWebMockHTTPRequest): Boolean + begin + Result := True; + end + ).ToRespondWith( + procedure(const ARequest: IWebMockHTTPRequest; const AResponse: IWebMockResponseBuilder) + begin + AResponse + .WithStatus(555) + .WithBody('Dynamic response.'); + end + ); + + LResponse := WebClient.Get(WebMock.URLFor('/')); + + Assert.AreEqual(555, LResponse.StatusCode); +end; + +procedure TWebMockDynamicResponsesTests.DynamicResponse_WithStaticMatcher_ReceivesRequest; +var + LResponse: IHTTPResponse; +begin + WebMock.StubRequest('*', '*') + .ToRespondWith( + procedure(const ARequest: IWebMockHTTPRequest; const AResponse: IWebMockResponseBuilder) + begin + AResponse + .WithStatus(555) + .WithBody('Dynamic response.'); + end + ); + + LResponse := WebClient.Get(WebMock.URLFor('/')); + + Assert.AreEqual(555, LResponse.StatusCode); +end; + +procedure TWebMockDynamicResponsesTests.Setup; +begin + WebMock := TWebMock.Create; +end; + +procedure TWebMockDynamicResponsesTests.TearDown; +begin + WebMock.Free; +end; + +initialization + TDUnitX.RegisterTestFixture(TWebMockDynamicResponsesTests); +end. diff --git a/Tests/WebMock.Dynamic.RequestStub.Tests.pas b/Tests/WebMock.Dynamic.RequestStub.Tests.pas index 7d3a9dd..42a5bc0 100644 --- a/Tests/WebMock.Dynamic.RequestStub.Tests.pas +++ b/Tests/WebMock.Dynamic.RequestStub.Tests.pas @@ -44,10 +44,6 @@ TWebMockDynamicRequestStubTests = class(TObject) [Test] procedure IsMatch_WhenInitializedWithFunctionReturningFalse_ReturnsFalse; [Test] - procedure GetResponse_Always_GetsResponse; - [Test] - procedure SetResponse_Always_SetsResponse; - [Test] procedure ToRespond_Always_ReturnsAResponseStub; [Test] procedure ToRespond_WithNoArguments_DoesNotRaiseException; @@ -60,10 +56,13 @@ TWebMockDynamicRequestStubTests = class(TObject) implementation uses - Mock.Indy.HTTPRequestInfo, IdCustomHTTPServer, - WebMock.HTTP.Messages, WebMock.HTTP.Request, WebMock.RequestStub, - WebMock.Response, WebMock.ResponseStatus; + Mock.Indy.HTTPRequestInfo, + WebMock.HTTP.Messages, + WebMock.HTTP.Request, + WebMock.RequestStub, + WebMock.Response, + WebMock.ResponseStatus; { TWebMockDynamicRequestStubTests } @@ -81,11 +80,6 @@ procedure TWebMockDynamicRequestStubTests.Class_Always_ImplementsIWebMockRequest Assert.Implements(LSubject); end; -procedure TWebMockDynamicRequestStubTests.GetResponse_Always_GetsResponse; -begin - Assert.IsTrue(StubbedRequest.GetResponse <> nil, 'GetResponse should return a response'); -end; - procedure TWebMockDynamicRequestStubTests.IsMatch_WhenInitializedWithFunctionReturningFalse_ReturnsFalse; var LRequestInfo: TIdHTTPRequestInfo; @@ -122,31 +116,21 @@ procedure TWebMockDynamicRequestStubTests.IsMatch_WhenInitializedWithFunctionRet Assert.IsTrue(StubbedRequest.IsMatch(LRequest)); end; -procedure TWebMockDynamicRequestStubTests.SetResponse_Always_SetsResponse; -var - LResponse: TWebMockResponse; -begin - LResponse := TWebMockResponse.Create; - - StubbedRequest.SetResponse(LResponse); - - Assert.AreSame(LResponse, StubbedRequest.Response, 'SetResponse should set Response'); -end; - procedure TWebMockDynamicRequestStubTests.ToRespond_Always_ReturnsAResponseStub; begin - Assert.IsTrue(StubbedRequest.ToRespond is TWebMockResponse); + Assert.IsNotNull(StubbedRequest.ToRespond as IWebMockResponseBuilder); end; procedure TWebMockDynamicRequestStubTests.ToRespond_WithNoArguments_DoesNotChangeStatus; var LExpectedStatus: TWebMockResponseStatus; begin - LExpectedStatus := StubbedRequest.Response.Status; + LExpectedStatus := StubbedRequest.Responder.GetResponseTo(nil).Status; StubbedRequest.ToRespond; - Assert.AreSame(LExpectedStatus, StubbedRequest.Response.Status); + Assert.AreSame(LExpectedStatus, + StubbedRequest.Responder.GetResponseTo(nil).Status); end; procedure TWebMockDynamicRequestStubTests.ToRespond_WithNoArguments_DoesNotRaiseException; diff --git a/Tests/WebMock.Dynamic.Responder.Tests.pas b/Tests/WebMock.Dynamic.Responder.Tests.pas new file mode 100644 index 0000000..cdd83e0 --- /dev/null +++ b/Tests/WebMock.Dynamic.Responder.Tests.pas @@ -0,0 +1,137 @@ +{******************************************************************************} +{ } +{ Delphi-WebMocks } +{ } +{ Copyright (c) 2020 Richard Hatherall } +{ } +{ richard@appercept.com } +{ https://appercept.com } +{ } +{******************************************************************************} +{ } +{ Licensed under the Apache License, Version 2.0 (the "License"); } +{ you may not use this file except in compliance with the License. } +{ You may obtain a copy of the License at } +{ } +{ http://www.apache.org/licenses/LICENSE-2.0 } +{ } +{ Unless required by applicable law or agreed to in writing, software } +{ distributed under the License is distributed on an "AS IS" BASIS, } +{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } +{ See the License for the specific language governing permissions and } +{ limitations under the License. } +{ } +{******************************************************************************} + +unit WebMock.Dynamic.Responder.Tests; + +interface + +uses + DUnitX.TestFramework, + Mock.Indy.HTTPRequestInfo, + WebMock.Dynamic.Responder, + WebMock.HTTP.Messages, + WebMock.HTTP.Request; + +type + [TestFixture] + TWebMockDynamicResponderTests = class(TObject) + private + Responder: TWebMockDynamicResponder; + IndyRequest: TMockIdHTTPRequestInfo; + Request: IWebMockHTTPRequest; + public + [Setup] + procedure Setup; + [TearDown] + procedure TearDown; + [Test] + procedure GetResponseTo_Always_ReturnsResponse; + [Test] + procedure GetResponseTo_Always_CallsProcWithRequest; + [Test] + procedure GetResponseTo_Always_CallsProcWithInitialisedResponseBuilder; + [Test] + procedure GetResponseTo_Always_ReturnsBuiltResponse; + end; + +implementation + +uses + WebMock.Response; + +{ TWebMockDynamicResponderTests } + +procedure TWebMockDynamicResponderTests.GetResponseTo_Always_CallsProcWithInitialisedResponseBuilder; +begin + Responder := TWebMockDynamicResponder.Create( + procedure(const ARequest: IWebMockHTTPRequest; const AResponse: IWebMockResponseBuilder) + begin + Assert.IsNotNull(AResponse, 'Response builder should be initialised.'); + end + ); + Responder.GetResponseTo(Request); + + Responder.Free; +end; + +procedure TWebMockDynamicResponderTests.GetResponseTo_Always_CallsProcWithRequest; +begin + Responder := TWebMockDynamicResponder.Create( + procedure(const ARequest: IWebMockHTTPRequest; const AResponse: IWebMockResponseBuilder) + begin + Assert.AreSame(Request, ARequest); + end + ); + Responder.GetResponseTo(Request); + + Responder.Free; +end; + +procedure TWebMockDynamicResponderTests.GetResponseTo_Always_ReturnsBuiltResponse; +var + LResponse: TWebMockResponse; +begin + Responder := TWebMockDynamicResponder.Create( + procedure(const ARequest: IWebMockHTTPRequest; const AResponse: IWebMockResponseBuilder) + begin + AResponse.WithStatus(401); + end + ); + LResponse := Responder.GetResponseTo(Request); + + Assert.AreEqual(401, LResponse.Status.Code); + + Responder.Free; +end; + +procedure TWebMockDynamicResponderTests.GetResponseTo_Always_ReturnsResponse; +begin + Responder := TWebMockDynamicResponder.Create( + procedure(const ARequest: IWebMockHTTPRequest; const AResponse: IWebMockResponseBuilder) + begin + // Do nothing. + end + ); + + Assert.IsNotNull(Responder.GetResponseTo(nil)); + + Responder.Free; +end; + +procedure TWebMockDynamicResponderTests.Setup; +begin + IndyRequest := TMockIdHTTPRequestInfo.Mock; + Request := TWebMockHTTPRequest.Create(IndyRequest); +end; + +procedure TWebMockDynamicResponderTests.TearDown; +begin + Request := nil; + IndyRequest.Free; +end; + +initialization + TDUnitX.RegisterTestFixture(TWebMockDynamicResponderTests); +end. diff --git a/Tests/WebMock.HTTP.RequestMatcher.Tests.pas b/Tests/WebMock.HTTP.RequestMatcher.Tests.pas index bb22302..a7f58bf 100644 --- a/Tests/WebMock.HTTP.RequestMatcher.Tests.pas +++ b/Tests/WebMock.HTTP.RequestMatcher.Tests.pas @@ -75,9 +75,13 @@ implementation uses Mock.Indy.HTTPRequestInfo, TestHelpers, - System.Classes, System.Generics.Collections, - WebMock.HTTP.Messages, WebMock.HTTP.Request, WebMock.StringMatcher, - WebMock.StringAnyMatcher, WebMock.StringWildcardMatcher; + System.Classes, + System.Generics.Collections, + WebMock.HTTP.Messages, + WebMock.HTTP.Request, + WebMock.StringMatcher, + WebMock.StringAnyMatcher, + WebMock.StringWildcardMatcher; { TWebMockHTTPRequestMatcherTests } diff --git a/Tests/WebMock.Response.Tests.pas b/Tests/WebMock.Response.Tests.pas index ee4af18..47886ba 100644 --- a/Tests/WebMock.Response.Tests.pas +++ b/Tests/WebMock.Response.Tests.pas @@ -2,7 +2,7 @@ { } { Delphi-WebMocks } { } -{ Copyright (c) 2019 Richard Hatherall } +{ Copyright (c) 2019-2020 Richard Hatherall } { } { richard@appercept.com } { https://appercept.com } @@ -32,7 +32,6 @@ interface WebMock.Response; type - [TestFixture] TWebMockResponseTests = class(TObject) private @@ -48,24 +47,6 @@ TWebMockResponseTests = class(TObject) procedure Create_WithStatus_SetsStatus; [Test] procedure BodySource_WhenNotSet_ReturnsEmptyContentSource; - [Test] - procedure WithBody_Always_ReturnsSelf; - [Test] - procedure WithBody_WithString_SetsResponseContent; - [Test] - procedure WithBodyFile_Always_ReturnsSelf; - [Test] - procedure WithBodyFile_WithValidFile_SetsResponseContent; - [Test] - procedure WithHeader_Always_ReturnsSelf; - [Test] - procedure WithHeader_Always_SetsValueForHeader; - [Test] - procedure WithHeader_Always_OverwritesExistingValues; - [Test] - procedure WithHeaders_Always_ReturnsSelf; - [Test] - procedure WithHeaders_Always_SetsAllValues; end; implementation @@ -73,7 +54,6 @@ implementation { TWebMockResponseTests } uses - System.Classes, TestHelpers, WebMock.ResponseStatus; @@ -87,114 +67,6 @@ procedure TWebMockResponseTests.TearDown; WebMockResponse.Free; end; -procedure TWebMockResponseTests.WithBodyFile_Always_ReturnsSelf; -begin - Assert.AreSame(WebMockResponse, WebMockResponse.WithBodyFile(FixturePath('Sample.txt'))); -end; - -procedure TWebMockResponseTests.WithBodyFile_WithValidFile_SetsResponseContent; -var - LExpectedContent: string; - LActualStream: TStringStream; -begin - LExpectedContent := 'Sample Text'; - - WebMockResponse.WithBodyFile(FixturePath('Sample.txt')); - - LActualStream := TStringStream.Create; - LActualStream.CopyFrom(WebMockResponse.BodySource.ContentStream, 0); - Assert.AreEqual( - LExpectedContent, - LActualStream.DataString - ); -end; - -procedure TWebMockResponseTests.WithBody_Always_ReturnsSelf; -begin - Assert.AreSame(WebMockResponse, WebMockResponse.WithBody('')); -end; - -procedure TWebMockResponseTests.WithBody_WithString_SetsResponseContent; -var - LExpectedContent: string; -begin - LExpectedContent := 'Text Body.'; - - WebMockResponse.WithBody(LExpectedContent); - - Assert.AreEqual( - LExpectedContent, - (WebMockResponse.BodySource.ContentStream as TStringStream).DataString - ); -end; - -procedure TWebMockResponseTests.WithHeaders_Always_ReturnsSelf; -var - LHeaders: TStringList; -begin - LHeaders := TStringList.Create; - - Assert.AreSame(WebMockResponse, WebMockResponse.WithHeaders(LHeaders)); - - LHeaders.Free; -end; - -procedure TWebMockResponseTests.WithHeaders_Always_SetsAllValues; -var - LHeaders: TStringList; - LHeaderName, LHeaderValue: string; - I: Integer; -begin - LHeaders := TStringList.Create; - LHeaders.Values['Header1'] := 'Value1'; - LHeaders.Values['Header2'] := 'Value2'; - - WebMockResponse.WithHeaders(LHeaders); - - for I := 0 to LHeaders.Count - 1 do - begin - LHeaderName := LHeaders.Names[I]; - LHeaderValue := LHeaders.ValueFromIndex[I]; - Assert.AreEqual(LHeaderValue, WebMockResponse.Headers.Values[LHeaderName]); - end; - - LHeaders.Free; -end; - -procedure TWebMockResponseTests.WithHeader_Always_OverwritesExistingValues; -var - LHeaderName, LHeaderValue1, LHeaderValue2: string; -begin - LHeaderName := 'Header1'; - LHeaderValue1 := 'Value1'; - LHeaderValue2 := 'Value2'; - - WebMockResponse.WithHeader(LHeaderName, LHeaderValue1); - WebMockResponse.WithHeader(LHeaderName, LHeaderValue2); - - Assert.AreEqual(LHeaderValue2, WebMockResponse.Headers.Values[LHeaderName]); -end; - -procedure TWebMockResponseTests.WithHeader_Always_ReturnsSelf; -begin - Assert.AreSame( - WebMockResponse, - WebMockResponse.WithHeader('Header1', 'Value1') - ); -end; - -procedure TWebMockResponseTests.WithHeader_Always_SetsValueForHeader; -var - LHeaderName, LHeaderValue: string; -begin - LHeaderName := 'Header1'; - LHeaderValue := 'Value1'; - - WebMockResponse.WithHeader(LHeaderName, LHeaderValue); - - Assert.AreEqual(LHeaderValue, WebMockResponse.Headers.Values[LHeaderName]); -end; - procedure TWebMockResponseTests.BodySource_WhenNotSet_ReturnsEmptyContentSource; begin Assert.AreEqual(Int64(0), WebMockResponse.BodySource.ContentStream.Size); diff --git a/Tests/WebMock.ResponseBuilder.Tests.pas b/Tests/WebMock.ResponseBuilder.Tests.pas new file mode 100644 index 0000000..8ec2c28 --- /dev/null +++ b/Tests/WebMock.ResponseBuilder.Tests.pas @@ -0,0 +1,234 @@ +{******************************************************************************} +{ } +{ Delphi-WebMocks } +{ } +{ Copyright (c) 2020 Richard Hatherall } +{ } +{ richard@appercept.com } +{ https://appercept.com } +{ } +{******************************************************************************} +{ } +{ Licensed under the Apache License, Version 2.0 (the "License"); } +{ you may not use this file except in compliance with the License. } +{ You may obtain a copy of the License at } +{ } +{ http://www.apache.org/licenses/LICENSE-2.0 } +{ } +{ Unless required by applicable law or agreed to in writing, software } +{ distributed under the License is distributed on an "AS IS" BASIS, } +{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } +{ See the License for the specific language governing permissions and } +{ limitations under the License. } +{ } +{******************************************************************************} + +unit WebMock.ResponseBuilder.Tests; + +interface + +uses + DUnitX.TestFramework, + WebMock.Response; + +type + [TestFixture] + TWebMockResponseBuilderTests = class(TObject) + private + Response: TWebMockResponse; + Builder: IWebMockResponseBuilder; + public + [Setup] + procedure Setup; + [TearDown] + procedure TearDown; + [Test] + procedure WithBody_Always_ReturnsBuilder; + [Test] + procedure WithBody_WithString_SetsResponseContent; + [Test] + procedure WithBodyFile_Always_ReturnsBuilder; + [Test] + procedure WithBodyFile_WithValidFile_SetsResponseContent; + [Test] + procedure WithHeader_Always_ReturnsBuilder; + [Test] + procedure WithHeader_Always_SetsValueForHeader; + [Test] + procedure WithHeader_Always_OverwritesExistingValues; + [Test] + procedure WithHeaders_Always_ReturnsBuilder; + [Test] + procedure WithHeaders_Always_SetsAllValues; + [Test] + procedure WithStatus_GivenStatus_ReturnsBuilder; + [Test] + procedure WithStatus_GivenStatus_SetsStatus; + [Test] + procedure WithStatus_GivenRawValues_ReturnsBuilder; + [Test] + procedure WithStatus_GivenRawValues_SetsStatusCode; + [Test] + procedure WithStatus_GivenRawValues_SetsStatusText; + end; + +implementation + +uses + System.Classes, + TestHelpers, + WebMock.ResponseStatus; + +{ TWebMockResponseBuilderTests } + +procedure TWebMockResponseBuilderTests.Setup; +begin + Response := TWebMockResponse.Create; + Builder := Response.Builder; +end; + +procedure TWebMockResponseBuilderTests.TearDown; +begin + Builder := nil; + Response.Free; +end; + +procedure TWebMockResponseBuilderTests.WithBodyFile_Always_ReturnsBuilder; +begin + Assert.AreSame(Builder, Builder.WithBodyFile(FixturePath('Sample.txt'))); +end; + +procedure TWebMockResponseBuilderTests.WithBodyFile_WithValidFile_SetsResponseContent; +var + LExpectedContent: string; + LActualStream: TStringStream; +begin + LExpectedContent := 'Sample Text'; + + Builder.WithBodyFile(FixturePath('Sample.txt')); + + LActualStream := TStringStream.Create; + LActualStream.CopyFrom(Response.BodySource.ContentStream, 0); + Assert.AreEqual( + LExpectedContent, + LActualStream.DataString + ); +end; + +procedure TWebMockResponseBuilderTests.WithBody_Always_ReturnsBuilder; +begin + Assert.AreSame(Builder, Builder.WithBody('')); +end; + +procedure TWebMockResponseBuilderTests.WithBody_WithString_SetsResponseContent; +var + LExpectedContent: string; +begin + LExpectedContent := 'Text Body.'; + + Builder.WithBody(LExpectedContent); + + Assert.AreEqual( + LExpectedContent, + (Response.BodySource.ContentStream as TStringStream).DataString + ); +end; + +procedure TWebMockResponseBuilderTests.WithHeaders_Always_ReturnsBuilder; +var + LHeaders: TStringList; +begin + LHeaders := TStringList.Create; + + Assert.AreSame(Builder, Builder.WithHeaders(LHeaders)); + + LHeaders.Free; +end; + +procedure TWebMockResponseBuilderTests.WithHeaders_Always_SetsAllValues; +var + LHeaders: TStringList; + LHeaderName, LHeaderValue: string; + I: Integer; +begin + LHeaders := TStringList.Create; + LHeaders.Values['Header1'] := 'Value1'; + LHeaders.Values['Header2'] := 'Value2'; + + Builder.WithHeaders(LHeaders); + + for I := 0 to LHeaders.Count - 1 do + begin + LHeaderName := LHeaders.Names[I]; + LHeaderValue := LHeaders.ValueFromIndex[I]; + Assert.AreEqual(LHeaderValue, Response.Headers.Values[LHeaderName]); + end; + + LHeaders.Free; +end; + +procedure TWebMockResponseBuilderTests.WithHeader_Always_OverwritesExistingValues; +var + LHeaderName, LHeaderValue1, LHeaderValue2: string; +begin + LHeaderName := 'Header1'; + LHeaderValue1 := 'Value1'; + LHeaderValue2 := 'Value2'; + + Builder.WithHeader(LHeaderName, LHeaderValue1); + Builder.WithHeader(LHeaderName, LHeaderValue2); + + Assert.AreEqual(LHeaderValue2, Response.Headers.Values[LHeaderName]); +end; + +procedure TWebMockResponseBuilderTests.WithHeader_Always_ReturnsBuilder; +begin + Assert.AreSame(Builder, Builder.WithHeader('Header1', 'Value1')); +end; + +procedure TWebMockResponseBuilderTests.WithHeader_Always_SetsValueForHeader; +var + LHeaderName, LHeaderValue: string; +begin + LHeaderName := 'Header1'; + LHeaderValue := 'Value1'; + + Builder.WithHeader(LHeaderName, LHeaderValue); + + Assert.AreEqual(LHeaderValue, Response.Headers.Values[LHeaderName]); +end; + +procedure TWebMockResponseBuilderTests.WithStatus_GivenRawValues_ReturnsBuilder; +begin + Assert.AreSame(Builder, Builder.WithStatus(555, 'Custom Status')); +end; + +procedure TWebMockResponseBuilderTests.WithStatus_GivenRawValues_SetsStatusCode; +begin + Builder.WithStatus(401); + + Assert.AreEqual(401, Response.Status.Code); +end; + +procedure TWebMockResponseBuilderTests.WithStatus_GivenRawValues_SetsStatusText; +begin + Builder.WithStatus(555, 'Custom Status'); + + Assert.AreEqual('Custom Status', Response.Status.Text); +end; + +procedure TWebMockResponseBuilderTests.WithStatus_GivenStatus_ReturnsBuilder; +begin + Assert.AreSame(Builder, Builder.WithStatus(TWebMockResponseStatus.InternalServerError)); +end; + +procedure TWebMockResponseBuilderTests.WithStatus_GivenStatus_SetsStatus; +begin + Builder.WithStatus(TWebMockResponseStatus.InternalServerError); + + Assert.AreEqual(500, Response.Status.Code); +end; + +initialization + TDUnitX.RegisterTestFixture(TWebMockResponseBuilderTests); +end. diff --git a/Tests/WebMock.Static.RequestStub.Tests.pas b/Tests/WebMock.Static.RequestStub.Tests.pas index 4dcf1ec..6af741d 100644 --- a/Tests/WebMock.Static.RequestStub.Tests.pas +++ b/Tests/WebMock.Static.RequestStub.Tests.pas @@ -2,7 +2,7 @@ { } { Delphi-WebMocks } { } -{ Copyright (c) 2019 Richard Hatherall } +{ Copyright (c) 2019-2020 Richard Hatherall } { } { richard@appercept.com } { https://appercept.com } @@ -81,9 +81,14 @@ implementation uses IdCustomHTTPServer, Mock.Indy.HTTPRequestInfo, - System.Classes, System.RegularExpressions, - WebMock.HTTP.RequestMatcher, WebMock.RequestStub, WebMock.Response, - WebMock.ResponseStatus, WebMock.StringMatcher, WebMock.StringWildcardMatcher, + System.Classes, + System.RegularExpressions, + WebMock.HTTP.RequestMatcher, + WebMock.RequestStub, + WebMock.Response, + WebMock.ResponseStatus, + WebMock.StringMatcher, + WebMock.StringWildcardMatcher, WebMock.StringRegExMatcher; { TWebMockRequestStubTests } @@ -112,7 +117,7 @@ procedure TWebMockStaticRequestStubTests.TearDown; procedure TWebMockStaticRequestStubTests.ToRespond_Always_ReturnsAResponseStub; begin - Assert.IsTrue(StubbedRequest.ToRespond is TWebMockResponse); + Assert.IsNotNull(StubbedRequest.ToRespond as IWebMockResponseBuilder); end; procedure TWebMockStaticRequestStubTests.ToRespond_WithNoArguments_DoesNotRaiseException; @@ -128,11 +133,12 @@ procedure TWebMockStaticRequestStubTests.ToRespond_WithNoArguments_DoesNotChange var LExpectedStatus: TWebMockResponseStatus; begin - LExpectedStatus := StubbedRequest.Response.Status; + LExpectedStatus := StubbedRequest.Responder.GetResponseTo(nil).Status; StubbedRequest.ToRespond; - Assert.AreSame(LExpectedStatus, StubbedRequest.Response.Status); + Assert.AreSame(LExpectedStatus, + StubbedRequest.Responder.GetResponseTo(nil).Status); end; procedure TWebMockStaticRequestStubTests.ToRespond_WithResponse_SetsResponseStatus; @@ -143,7 +149,7 @@ procedure TWebMockStaticRequestStubTests.ToRespond_WithResponse_SetsResponseStat StubbedRequest.ToRespond(LResponse); - Assert.AreSame(LResponse, StubbedRequest.Response.Status); + Assert.AreSame(LResponse, StubbedRequest.Responder.GetResponseTo(nil).Status); end; procedure TWebMockStaticRequestStubTests.WithBody_GivenRegEx_ReturnsSelf; diff --git a/Tests/WebMock.Static.Responder.Tests.pas b/Tests/WebMock.Static.Responder.Tests.pas new file mode 100644 index 0000000..6177eb3 --- /dev/null +++ b/Tests/WebMock.Static.Responder.Tests.pas @@ -0,0 +1,65 @@ +{******************************************************************************} +{ } +{ Delphi-WebMocks } +{ } +{ Copyright (c) 2020 Richard Hatherall } +{ } +{ richard@appercept.com } +{ https://appercept.com } +{ } +{******************************************************************************} +{ } +{ Licensed under the Apache License, Version 2.0 (the "License"); } +{ you may not use this file except in compliance with the License. } +{ You may obtain a copy of the License at } +{ } +{ http://www.apache.org/licenses/LICENSE-2.0 } +{ } +{ Unless required by applicable law or agreed to in writing, software } +{ distributed under the License is distributed on an "AS IS" BASIS, } +{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. } +{ See the License for the specific language governing permissions and } +{ limitations under the License. } +{ } +{******************************************************************************} + +unit WebMock.Static.Responder.Tests; + +interface + +uses + DUnitX.TestFramework, + WebMock.Static.Responder; + +type + [TestFixture] + TWebMockStaticResponderTests = class(TObject) + private + Responder: TWebMockStaticResponder; + public + [Test] + procedure GetResponseTo_Always_ReturnsResponse; + end; + +implementation + +uses + WebMock.Response; + +{ TWebMockStaticResponderTests } + +procedure TWebMockStaticResponderTests.GetResponseTo_Always_ReturnsResponse; +var + LResponse: TWebMockResponse; +begin + LResponse := TWebMockResponse.Create; + Responder := TWebMockStaticResponder.Create(LResponse); + + Assert.AreSame(LResponse, Responder.GetResponseTo(nil) as TWebMockResponse); + + Responder.Free; +end; + +initialization + TDUnitX.RegisterTestFixture(TWebMockStaticResponderTests); +end. diff --git a/Tests/WebMocks.Tests.dpr b/Tests/WebMocks.Tests.dpr index 1587250..2d77935 100644 --- a/Tests/WebMocks.Tests.dpr +++ b/Tests/WebMocks.Tests.dpr @@ -53,7 +53,14 @@ uses WebMock.DynamicMatching.Tests in 'Features\WebMock.DynamicMatching.Tests.pas', WebMock.Dynamic.RequestStub.Tests in 'WebMock.Dynamic.RequestStub.Tests.pas', WebMock.Dynamic.RequestStub in '..\Source\WebMock.Dynamic.RequestStub.pas', - WebMock.RequestStub in '..\Source\WebMock.RequestStub.pas'; + WebMock.RequestStub in '..\Source\WebMock.RequestStub.pas', + WebMock.Static.Responder.Tests in 'WebMock.Static.Responder.Tests.pas', + WebMock.Static.Responder in '..\Source\WebMock.Static.Responder.pas', + WebMock.Responder in '..\Source\WebMock.Responder.pas', + WebMock.ResponseBuilder.Tests in 'WebMock.ResponseBuilder.Tests.pas', + WebMock.DynamicResponses.Tests in 'Features\WebMock.DynamicResponses.Tests.pas', + WebMock.Dynamic.Responder.Tests in 'WebMock.Dynamic.Responder.Tests.pas', + WebMock.Dynamic.Responder in '..\Source\WebMock.Dynamic.Responder.pas'; var Runner: ITestRunner; diff --git a/Tests/WebMocks.Tests.dproj b/Tests/WebMocks.Tests.dproj index fc05794..28418d7 100644 --- a/Tests/WebMocks.Tests.dproj +++ b/Tests/WebMocks.Tests.dproj @@ -186,6 +186,13 @@ + + + + + + + Cfg_2 Base @@ -248,6 +255,12 @@ true + + + WebMocks_Tests.exe + true + + true From 2f5ff4dbced0899d17fd8c77c9e65271f4be2d6d Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Wed, 25 Nov 2020 20:55:36 +0000 Subject: [PATCH 14/15] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a12ee58..72394ff 100644 --- a/README.md +++ b/README.md @@ -26,14 +26,14 @@ not be found in your test projects. ## Installation: Manual 1. Download and extract the latest version - [1.3.0](https://github.com/appercept/Delphi-WebMocks/archive/1.3.0.zip). + [2.0.0](https://github.com/appercept/Delphi-WebMocks/archive/2.0.0.zip). 2. In "Tools > Options" under the "Language / Delphi / Library" add the extracted `Source` directory to the "Library path" and "Browsing path". -## Unreleased Breaking Changes -Version 2 will include a change to the unit naming within the project. All units -have the `Delphi.` prefix dropped. Existing projects will need to have their -`uses` clauses updated to remove any `Delphi.` prefixes from WebMocks units. +## Upgrading to versions prior to 2.0.0 +Version 2 has dropped the `Delphi.` namespace from all units. Any projects +upgrade to version 2 or later will need to drop the `Delphi.` prefix from any +included WebMocks units. ## Setup In your test unit file a couple of simple steps are required. From 646b5bbc8e16feb2a026094caba8e41ee79ab703 Mon Sep 17 00:00:00 2001 From: Richard Hatherall Date: Wed, 25 Nov 2020 21:01:35 +0000 Subject: [PATCH 15/15] Update CHANGELOG.md --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 849816b..3d2d261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## [2.0.0](https://github.com/appercept/Delphi-WebMocks/tree/2.0.0) (2020-11-25) + +[Full Changelog](https://github.com/appercept/Delphi-WebMocks/compare/1.3.0...2.0.0) + +**Implemented enhancements:** + +- Dynamic response stubs [\#16](https://github.com/appercept/Delphi-WebMocks/issues/16) +- Add support for dynamic responses [\#40](https://github.com/appercept/Delphi-WebMocks/pull/40) ([rhatherall](https://github.com/rhatherall)) +- Remove packages for Delphinus installation [\#39](https://github.com/appercept/Delphi-WebMocks/pull/39) ([rhatherall](https://github.com/rhatherall)) +- Remove `Delphi.` unit prefix [\#38](https://github.com/appercept/Delphi-WebMocks/pull/38) ([rhatherall](https://github.com/rhatherall)) + +**Fixed bugs:** + +- Unsupported Authorisation Scheme error when setting Authorization header [\#34](https://github.com/appercept/Delphi-WebMocks/issues/34) +- Repeated calls to stubs with content causes exception [\#32](https://github.com/appercept/Delphi-WebMocks/issues/32) + +**Closed issues:** + +- Packages are not required for Delphinus installation [\#37](https://github.com/appercept/Delphi-WebMocks/issues/37) +- Remove `Delphi.` namespace prefix [\#36](https://github.com/appercept/Delphi-WebMocks/issues/36) + +**Merged pull requests:** + +- Allow any authorization header values for stubs [\#35](https://github.com/appercept/Delphi-WebMocks/pull/35) ([rhatherall](https://github.com/rhatherall)) +- Use fresh content streams for successive requests [\#33](https://github.com/appercept/Delphi-WebMocks/pull/33) ([rhatherall](https://github.com/rhatherall)) + ## [1.3.0](https://github.com/appercept/Delphi-WebMocks/tree/1.3.0) (2020-10-07) [Full Changelog](https://github.com/appercept/Delphi-WebMocks/compare/1.2.2...1.3.0)