Skip to content

Commit dac1c8f

Browse files
committed
ECER-5270: Country check added to automated test
1 parent 6a1783a commit dac1c8f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/ECER.Tests/Integration/RegistryApi/IcraTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Alba;
22
using Bogus;
33
using ECER.Clients.RegistryPortal.Server.ICRA;
4+
using ECER.Clients.RegistryPortal.Server;
45
using Shouldly;
56
using System.Net;
67
using System.Net.Http.Headers;
@@ -130,6 +131,17 @@ public async Task SaveDraftIcraEligibility_WithInternationalCertificationAndFile
130131

131132
var uploadedFileResponse = (await fileResponse.ReadAsJsonAsync<ECER.Clients.RegistryPortal.Server.Files.FileResponse>()).ShouldNotBeNull();
132133

134+
var countriesResponse = await Host.Scenario(_ =>
135+
{
136+
_.WithExistingUser(this.Fixture.AuthenticatedBcscUserIdentity, this.Fixture.AuthenticatedBcscUser);
137+
_.Get.Url("/api/countrylist");
138+
_.StatusCodeShouldBeOk();
139+
});
140+
141+
var countries = await countriesResponse.ReadAsJsonAsync<Country[]>();
142+
countries.ShouldNotBeNull();
143+
var countryId = countries.FirstOrDefault(c => c.IsICRA)?.CountryId ?? countries.First().CountryId;
144+
133145
var eligibility = new ICRAEligibility
134146
{
135147
Status = ICRAStatus.Draft,
@@ -141,6 +153,7 @@ public async Task SaveDraftIcraEligibility_WithInternationalCertificationAndFile
141153
CertificateTitle = faker.Company.CatchPhrase(),
142154
IssueDate = faker.Date.Past(),
143155
ExpiryDate = faker.Date.Soon(),
156+
CountryId = countryId,
144157
NewFiles = new [] { uploadedFileResponse.fileId }
145158
}
146159
}
@@ -168,5 +181,6 @@ public async Task SaveDraftIcraEligibility_WithInternationalCertificationAndFile
168181
fetched.InternationalCertifications.ShouldHaveSingleItem();
169182
fetched.InternationalCertifications.First().Files.ShouldHaveSingleItem();
170183
fetched.InternationalCertifications.First().Files.First().Id!.ShouldContain(uploadedFileResponse.fileId);
184+
fetched.InternationalCertifications.First().CountryId.ShouldBe(countryId);
171185
}
172186
}

0 commit comments

Comments
 (0)