Skip to content

Commit

Permalink
Automated Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
geschwint committed Feb 5, 2025
1 parent 998accc commit d7fd553
Show file tree
Hide file tree
Showing 6 changed files with 881 additions and 41 deletions.
82 changes: 41 additions & 41 deletions Apps/W1/EDocumentConnectors/SignUp/app/app.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
{
"id": "b56171bd-9a8e-47ad-a527-99f476d5af83",
"name": "E-Document Connector - SignUp",
"publisher": "Microsoft",
"brief": "E-Document Connector - SignUp",
"description": "E-Document Connector - SignUp",
"version": "26.0.0.0",
"privacyStatement": "https://go.microsoft.com/fwlink/?LinkId=724009",
"EULA": "https://go.microsoft.com/fwlink/?linkid=2009120",
"help": "https://go.microsoft.com/fwlink/?linkid=2204541",
"url": "https://go.microsoft.com/fwlink/?LinkId=724011",
"logo": "ExtensionLogo.png",
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2206603",
"dependencies": [
{
"id": "e1d97edc-c239-46b4-8d84-6368bdf67c8b",
"name": "E-Document Core",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "d852a468-263e-49e5-bfda-f09e33342b89",
"name": "E-Documents Connector with External Endpoints",
"publisher": "Microsoft",
"version": "26.0.0.0"
}
],
"id": "b56171bd-9a8e-47ad-a527-99f476d5af83",
"name": "E-Document Connector - SignUp",
"publisher": "Microsoft",
"brief": "E-Document Connector - SignUp",
"description": "E-Document Connector - SignUp",
"version": "26.0.0.0",
"privacyStatement": "https://go.microsoft.com/fwlink/?LinkId=724009",
"EULA": "https://go.microsoft.com/fwlink/?linkid=2009120",
"help": "https://go.microsoft.com/fwlink/?linkid=2204541",
"url": "https://go.microsoft.com/fwlink/?LinkId=724011",
"logo": "ExtensionLogo.png",
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2206603",
"dependencies": [
{
"id": "e1d97edc-c239-46b4-8d84-6368bdf67c8b",
"name": "E-Document Core",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "d852a468-263e-49e5-bfda-f09e33342b89",
"name": "E-Documents Connector with External Endpoints",
"publisher": "Microsoft",
"version": "26.0.0.0"
}
],
"internalsVisibleTo": [],
"screenshots": [],
"platform": "26.0.0.0",
"idRanges": [
{
"from": 6380,
"to": 6389
}
],
"resourceExposurePolicy": {
"allowDebugging": true,
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"application": "26.0.0.0",
"target": "OnPrem",
"screenshots": [],
"platform": "26.0.0.0",
"idRanges": [
{
"from": 6380,
"to": 6389
}
],
"resourceExposurePolicy": {
"allowDebugging": true,
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"application": "26.0.0.0",
"target": "OnPrem",
"features": [
"TranslationFile"
]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
113 changes: 113 additions & 0 deletions Apps/W1/EDocumentConnectors/SignUp/test/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"id": "b56171bd-9a8e-47ad-a527-99f476d5af83",
"name": "E-Document Connector - SignUp Tests",
"publisher": "Microsoft",
"brief": "E-Document Connector - SignUp Tests",
"description": "E-Document Connector - SignUp Tests",
"version": "26.0.0.0",
"privacyStatement": "https://go.microsoft.com/fwlink/?LinkId=724009",
"EULA": "https://go.microsoft.com/fwlink/?linkid=2009120",
"help": "https://go.microsoft.com/fwlink/?linkid=2204541",
"url": "https://go.microsoft.com/fwlink/?LinkId=724011",
"logo": "ExtensionLogo.png",
"contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2206603",
"dependencies": [
{
"id": "b56171bd-9a8e-47ad-a527-99f476d5af83",
"name": "E-Document Connector - SignUp",
"publisher": "SignUp Software AB",
"version": "26.0.0.0"
},
{
"id": "e1d97edc-c239-46b4-8d84-6368bdf67c8b",
"name": "E-Document Core",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "de0dddf3-9917-430d-8d20-6e7679a08500",
"name": "E-Document Core Demo Data",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "5a0b41e9-7a42-4123-d521-2265186cfb31",
"name": "Contoso Coffee Demo Dataset",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "e1d97edc-c239-46b4-8d84-6368bdf67c8c",
"name": "E-Document Core Tests",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "dd0be2ea-f733-4d65-bb34-a28f4624fb14",
"name": "Library Assert",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "e7320ebb-08b3-4406-b1ec-b4927d3e280b",
"name": "Any",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "5d86850b-0d76-4eca-bd7b-951ad998e997",
"name": "Tests-TestLibraries",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "9856ae4f-d1a7-46ef-89bb-6ef056398228",
"name": "System Application Test Library",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "23de40a6-dfe8-4f80-80db-d70f83ce8caf",
"name": "Test Runner",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "5095f467-0a01-4b99-99d1-9ff1237d286f",
"name": "Library Variable Storage",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "bee8cf2f-494a-42f4-aabd-650e87934d39",
"name": "Business Foundation Test Libraries",
"publisher": "Microsoft",
"version": "26.0.0.0"
},
{
"id": "40860557-a18d-42ad-aecb-22b7dd80dc80",
"name": "Permissions Mock",
"publisher": "Microsoft",
"version": "26.0.0.0"
}
],
"screenshots": [],
"platform": "26.0.0.0",
"application": "26.0.0.0",
"idRanges": [
{
"from": 148195,
"to": 148199
}
],
"resourceExposurePolicy": {
"allowDebugging": true,
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"runtime": "15.0",
"features": [
"TranslationFile"
],
"target": "OnPrem"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Microsoft.EServices.EDocumentConnector.SignUp;


codeunit 148197 IntegrationEvents
{
EventSubscriberInstance = Manual;

var
LibraryLowerPermissions: Codeunit "Library - Lower Permissions";
IntegrationHelpers: Codeunit IntegrationHelpers;

[EventSubscriber(ObjectType::Codeunit, Codeunit::Processing, OnBeforeGetTargetDocumentRequest, '', true, true)]
local procedure ProcessingOnBeforeGetTargetDocumentRequest()
begin
this.LibraryLowerPermissions.AddPermissionSet('SignUpEDCOEdit');
this.IntegrationHelpers.SetAPICode('/signup/200/download');
this.LibraryLowerPermissions.AddPermissionSet('SignUpEDCORead');
end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::Processing, OnBeforeGetTargetDocumentRequest, '', true, true)]
local procedure ProcessingOnBeforeMarkFetched()
begin
this.LibraryLowerPermissions.AddPermissionSet('SignUpEDCOEdit');
this.IntegrationHelpers.SetAPICode('/signup/200/markdownloaded');
this.LibraryLowerPermissions.AddPermissionSet('SignUpEDCORead');
end;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
namespace Microsoft.EServices.EDocumentConnector.SignUp;


codeunit 148196 IntegrationHelpers
{
internal procedure SetAPIWith200Code()
begin
this.SetAPICode('/signup/200');
end;

internal procedure SetAPIWith500Code()
begin
this.SetAPICode('/signup/500');
end;

internal procedure SetAPICode(Path: Text)
var
ConnectionSetup: Record ConnectionSetup;
begin
ConnectionSetup.Get();
ConnectionSetup."Service URL" := this.SetMockServiceUrl(Path);
ConnectionSetup.Modify(true);
end;

internal procedure SetCommonConnectionSetup()
var
ConnectionSetup: Record ConnectionSetup;
Authentication: Codeunit Authentication;
begin
ConnectionSetup.Get();
Authentication.StorageSet(ConnectionSetup."Root App ID", this.DummyId());
Authentication.StorageSet(ConnectionSetup."Root Secret", this.DummyId());
Authentication.StorageSet(ConnectionSetup."Root Tenant", this.DummyId());
Authentication.StorageSet(ConnectionSetup."Client ID", this.DummyId());
Authentication.StorageSet(ConnectionSetup."Client Secret", this.DummyId());
Authentication.StorageSet(ConnectionSetup."Client Tenant", this.ClientTenantId());

ConnectionSetup."Authentication URL" := this.SetMockServiceUrl('/%1/oauth2/token');
ConnectionSetup."Environment Type" := ConnectionSetup."Environment Type"::Test;
ConnectionSetup.Modify(true);
end;

internal procedure SetMockServiceUrl(Path: Text): Text[250]
begin
exit('http://localhost:8080' + Path);
end;

local procedure ClientTenantId(): Text
begin
exit('signup');
end;

local procedure DummyId(): Text[100]
begin
exit('0a4b7f70-452a-4883-844f-296443704124');
end;

internal procedure MockServiceDocumentId(): Text
begin
exit('485959a5-4a96-4a41-a208-13c30bb7e4d3');
end;

internal procedure MockCompanyId(): Text[100]
begin
exit('0007:SIGNUPSOFTWARE');
end;
}
Loading

0 comments on commit d7fd553

Please sign in to comment.