Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/api-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ jobs:
if: failure()
run: |
mkdir docker-logs
docker logs ed-fi-db-admin > docker-logs/ed-fi-db-admin.log
docker logs adminapi > docker-logs/adminapi.log
docker logs ed-fi-db-admin-adminapi > docker-logs/ed-fi-db-admin.log
docker logs ed-fi-gateway-adminapi > docker-logs/ed-fi-gateway.log

- name: Upload Docker logs
if: failure()
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/on-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ jobs:
# SemVer
"admin-api-semver=$($apiVersion -Replace $apiPrefix)" >> $env:GITHUB_OUTPUT

- name: Setup .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3
with:
dotnet-version: 6.0.x

- name: Publish .NET Assemblies
run: |
$apiVersion = "${{ steps.versions.outputs.admin-api-semver }}"
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/on-pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ jobs:
steps:
- name: Checkout the Repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup .NET
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # v3.0.3
with:
dotnet-version: 6.0.x

- name: Build
run: ./build.ps1 -Command Build -Configuration Debug
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ credentials-*.xml
libs/
libs.codegen/

Docker/Application
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using EdFi.Admin.DataAccess.Models;
using EdFi.Ods.AdminApi.Infrastructure;
using EdFi.Ods.AdminApi.Infrastructure.Database.Commands;
using Microsoft.EntityFrameworkCore;
using NUnit.Framework;
using Shouldly;

Expand Down Expand Up @@ -73,7 +74,12 @@ public void ProfileShouldBeOptional()

Transaction(usersContext =>
{
var persistedApplication = usersContext.Applications.Single(a => a.ApplicationId == result.ApplicationId);
var persistedApplication = usersContext.Applications
.Include(x => x.Profiles)
.Include(x => x.ApplicationEducationOrganizations)
.Include(x => x.Vendor)
.Include(x => x.ApiClients)
.Single(a => a.ApplicationId == result.ApplicationId);

persistedApplication.ClaimSetName.ShouldBe("FakeClaimSet");
persistedApplication.Profiles.Count.ShouldBe(0);
Expand Down Expand Up @@ -142,7 +148,13 @@ public void ShouldExecute()

Transaction(usersContext =>
{
var persistedApplication = usersContext.Applications.Single(a => a.ApplicationId == result.ApplicationId);
var persistedApplication = usersContext.Applications
.Include(x => x.Profiles)
.Include(x => x.ApplicationEducationOrganizations)
.Include(x => x.Vendor)
.Include(x => x.ApiClients)
.Include(x => x.OdsInstance)
.Single(a => a.ApplicationId == result.ApplicationId);

persistedApplication.ClaimSetName.ShouldBe("FakeClaimSet");
persistedApplication.Profiles.Count.ShouldBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Shouldly;
using System.Linq;
using EdFi.Ods.AdminApi.Infrastructure.Helpers;
using Microsoft.EntityFrameworkCore;

namespace EdFi.Ods.AdminApi.DBTests.Database.CommandTests;

Expand All @@ -36,7 +37,10 @@ public void ShouldAddVendor()

Transaction(usersContext =>
{
var vendor = usersContext.Vendors.Single(v => v.VendorId == id);
var vendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users)
.Single(v => v.VendorId == id);
vendor.VendorName.ShouldBe("test vendor");
vendor.VendorNamespacePrefixes.First().NamespacePrefix.ShouldBe("http://www.test.com/");
vendor.Users.Single().FullName.ShouldBe("test user");
Expand Down Expand Up @@ -70,7 +74,9 @@ public void ShouldAddVendorIfMultipleNamespacePrefixes()

Transaction(usersContext =>
{
var vendor = usersContext.Vendors.Single(v => v.VendorId == id);
var vendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users).Single(v => v.VendorId == id);
vendor.VendorName.ShouldBe("test vendor");
vendor.VendorNamespacePrefixes.Select(x => x.NamespacePrefix).ShouldBe(namespacePrefixes);
vendor.Users.Single().FullName.ShouldBe("test user");
Expand Down Expand Up @@ -101,7 +107,10 @@ public void ShouldNotAddEmptyNamespacePrefixesWhileAddingVendor(string inputName

Transaction(usersContext =>
{
var vendor = usersContext.Vendors.Single(v => v.VendorId == id);
var vendor = usersContext.Vendors.
Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users)
.Single(v => v.VendorId == id);
vendor.VendorName.ShouldBe("test vendor");
vendor.VendorNamespacePrefixes.Select(x => x.NamespacePrefix).ToDelimiterSeparated().ShouldBe(expectedNamespacePrefixes);
vendor.Users.Single().FullName.ShouldBe("test user");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Profile = EdFi.Admin.DataAccess.Models.Profile;
using System.Threading.Tasks;
using System.Data.SqlClient;
using Microsoft.EntityFrameworkCore;

namespace EdFi.Ods.AdminApi.DBTests.Database.CommandTests;

Expand Down Expand Up @@ -117,7 +118,11 @@ public void ShouldRemoveProfileIfNull()

Transaction(usersContext =>
{
var persistedApplication = usersContext.Applications.Single(a => a.ApplicationId == _application.ApplicationId);
var persistedApplication = usersContext.Applications
.Include(x => x.ApiClients)
.Include(x => x.ApplicationEducationOrganizations)
.Include(x => x.Profiles)
.Single(a => a.ApplicationId == _application.ApplicationId);
persistedApplication.ApplicationName.ShouldBe("Test Application");
persistedApplication.ClaimSetName.ShouldBe("FakeClaimSet");
persistedApplication.ApiClients.Count.ShouldBe(1);
Expand Down Expand Up @@ -152,7 +157,11 @@ public void ShouldUpdateAllEntitiesProperly()

Transaction(usersContext =>
{
var persistedApplication = usersContext.Applications.Single(a => a.ApplicationId == _application.ApplicationId);
var persistedApplication = usersContext.Applications
.Include(x => x.ApiClients)
.Include(x => x.ApplicationEducationOrganizations)
.Include(x => x.Profiles)
.Single(a => a.ApplicationId == _application.ApplicationId);
persistedApplication.ApplicationName.ShouldBe("New Application Name");
persistedApplication.ClaimSetName.ShouldBe("DifferentFakeClaimSet");
persistedApplication.ApiClients.Count.ShouldBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using EdFi.Admin.DataAccess.Models;
using VendorUser = EdFi.Admin.DataAccess.Models.User;
using EdFi.Ods.AdminApi.Infrastructure.Helpers;
using Microsoft.EntityFrameworkCore;

namespace EdFi.Ods.AdminApi.DBTests.Database.CommandTests;

Expand Down Expand Up @@ -67,7 +68,10 @@ public void ShouldEditVendorWithContact()

Transaction(usersContext =>
{
var changedVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var changedVendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users)
.Single(v => v.VendorId == _vendorId);
changedVendor.VendorName.ShouldBe("new vendor name");
changedVendor.VendorNamespacePrefixes.First().NamespacePrefix.ShouldBe("new namespace prefix");
changedVendor.Users.First().FullName.ShouldBe("new contact name");
Expand All @@ -93,7 +97,9 @@ public void ShouldEditVendorWithNoNameSpacePrefix()

Transaction(usersContext =>
{
var changedVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var changedVendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users).Single(v => v.VendorId == _vendorId);
changedVendor.VendorName.ShouldBe("new vendor name");
changedVendor.VendorNamespacePrefixes.ShouldBeEmpty();
changedVendor.Users.First().FullName.ShouldBe("new contact name");
Expand All @@ -119,7 +125,10 @@ public void ShouldEditVendorByAddingNewNameSpacePrefix()

Transaction(usersContext =>
{
var changedVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorWithNoNameSpaceId);
var changedVendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users).
Single(v => v.VendorId == _vendorWithNoNameSpaceId);
changedVendor.VendorName.ShouldBe("new vendor name");
changedVendor.VendorNamespacePrefixes.First().NamespacePrefix.ShouldBe("new namespace prefix");
changedVendor.Users.First().FullName.ShouldBe("new contact name");
Expand All @@ -133,7 +142,8 @@ public void ShouldEditVendorByAddingMultipleNameSpacePrefixes()
var newVendorData = new Mock<IEditVendor>();
Transaction(usersContext =>
{
var originalVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var originalVendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes).Single(v => v.VendorId == _vendorId);
originalVendor.VendorNamespacePrefixes.Single().NamespacePrefix.ShouldBe(OriginalVendorNamespacePrefix);
});
var newNamespacePrefixes = new List<string>
Expand All @@ -157,7 +167,10 @@ public void ShouldEditVendorByAddingMultipleNameSpacePrefixes()

Transaction(usersContext =>
{
var changedVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var changedVendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users)
.Single(v => v.VendorId == _vendorId);
changedVendor.VendorName.ShouldBe("new vendor name");
changedVendor.VendorNamespacePrefixes.Select(x => x.NamespacePrefix).ShouldBe(newNamespacePrefixes);
changedVendor.Users.First().FullName.ShouldBe("new contact name");
Expand All @@ -174,7 +187,9 @@ public void ShouldNotAddEmptyNameSpacePrefixesWhileEditingVendor(string inputNam
var newVendorData = new Mock<IEditVendor>();
Transaction(usersContext =>
{
var originalVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var originalVendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Single(v => v.VendorId == _vendorId);
originalVendor.VendorNamespacePrefixes.Single().NamespacePrefix.ShouldBe(OriginalVendorNamespacePrefix);
});

Expand All @@ -192,7 +207,10 @@ public void ShouldNotAddEmptyNameSpacePrefixesWhileEditingVendor(string inputNam

Transaction(usersContext =>
{
var changedVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var changedVendor = usersContext.Vendors
.Include(x => x.Users)
.Include(x => x.VendorNamespacePrefixes)
.Single(v => v.VendorId == _vendorId);
changedVendor.VendorName.ShouldBe("new vendor name");
changedVendor.VendorNamespacePrefixes.Select(x => x.NamespacePrefix).ToDelimiterSeparated().ShouldBe(expectedNamespacePrefixes);
changedVendor.Users.First().FullName.ShouldBe("new contact name");
Expand All @@ -207,7 +225,9 @@ public void ShouldEditVendorByRemovingNameSpacePrefix()

Transaction(usersContext =>
{
var originalVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var originalVendor = usersContext.Vendors
.Include (x => x.VendorNamespacePrefixes)
.Single(v => v.VendorId == _vendorId);
originalVendor.VendorNamespacePrefixes.Single().NamespacePrefix.ShouldBe(OriginalVendorNamespacePrefix);
});

Expand All @@ -225,7 +245,10 @@ public void ShouldEditVendorByRemovingNameSpacePrefix()

Transaction(usersContext =>
{
var changedVendor = usersContext.Vendors.Single(v => v.VendorId == _vendorId);
var changedVendor = usersContext.Vendors
.Include(x => x.VendorNamespacePrefixes)
.Include(x => x.Users)
.Single(v => v.VendorId == _vendorId);
changedVendor.VendorName.ShouldBe("new vendor name");
changedVendor.VendorNamespacePrefixes.ShouldBeEmpty();
changedVendor.Users.First().FullName.ShouldBe("new contact name");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\EdFi.Ods.AdminApi\EdFi.Ods.AdminApi.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="EdFi.Suite3.Admin.DataAccess" Version="6.1.38" />
<PackageReference Include="EdFi.Suite3.Security.DataAccess" Version="6.1.29" />

<PackageReference Include="EdFi.SecurityCompatiblity53.DataAccess" Version="5.3.66">
<Aliases>Compatability</Aliases>
</PackageReference>

<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="170.11.0" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="NuGet.Protocol" Version="6.6.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Respawn" Version="3.3.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
</ItemGroup>

<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\EdFi.Ods.AdminApi\EdFi.Ods.AdminApi.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EdFi.Suite3.Admin.DataAccess" Version="6.2.81" />
<PackageReference Include="EdFi.Suite3.Security.DataAccess" Version="6.2.61" />
<PackageReference Include="EdFi.SecurityCompatiblity53.DataAccess" Version="5.4.0">
<Aliases>Compatability</Aliases>
</PackageReference>
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.1.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="170.11.0" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="NuGet.Protocol" Version="6.6.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Respawn" Version="3.3.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
57 changes: 0 additions & 57 deletions Application/EdFi.Ods.AdminApi.DBTests/MockExtensions.cs

This file was deleted.

Loading