Skip to content

Commit

Permalink
Merge pull request #69 from hmcts/feature/test_data_cleanup
Browse files Browse the repository at this point in the history
Test data cleanup
  • Loading branch information
npoxon authored Sep 8, 2019
2 parents 6a90507 + f79c6cf commit f06c35b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public BookNewConferenceRequestBuilder()
.With(x => x.CaseType = "Civil Money Claims")
.With(x => x.ScheduledDateTime = DateTime.Now)
.With(x => x.CaseNumber = $"{GenerateRandom.CaseNumber(fromRandomNumber)}")
.With(x => x.CaseName = $"Automated Test Hearing {GenerateRandom.Letters(fromRandomNumber)}")
.With(x => x.CaseName = $"Video Api Automated Test {GenerateRandom.Letters(fromRandomNumber)}")
.With(x => x.ScheduledDuration = 120)
.With(x => x.Participants = new List<ParticipantRequest>())
.Build();
Expand All @@ -28,9 +28,9 @@ public BookNewConferenceRequestBuilder()
public BookNewConferenceRequestBuilder WithJudge()
{
var participant = Builder<ParticipantRequest>.CreateNew()
.With(x => x.Name = $"Automation {Name.FullName()}")
.With(x => x.Name = $"Automation_{Name.FullName()}")
.With(x => x.Username = $"Automation_{Internet.Email()}")
.With(x => x.DisplayName = $"Automation {Internet.UserName()}")
.With(x => x.DisplayName = $"Automation_{Internet.UserName()}")
.With(x => x.UserRole = UserRole.Judge)
.With(x => x.ParticipantRefId = Guid.NewGuid())
.Build();
Expand All @@ -42,9 +42,9 @@ public BookNewConferenceRequestBuilder WithJudge()
public BookNewConferenceRequestBuilder WithRepresentative(string caseTypeGroup = null)
{
var participant = Builder<ParticipantRequest>.CreateNew()
.With(x => x.Name = $"Automation {Name.FullName()}")
.With(x => x.Name = $"Automation_{Name.FullName()}")
.With(x => x.Username = $"Automation_{Internet.Email()}")
.With(x => x.DisplayName = $"Automation {Internet.UserName()}")
.With(x => x.DisplayName = $"Automation_{Internet.UserName()}")
.With(x => x.UserRole = UserRole.Representative)
.With(x => x.Representee = "Person")
.With(x => x.ParticipantRefId = Guid.NewGuid())
Expand All @@ -62,9 +62,9 @@ public BookNewConferenceRequestBuilder WithRepresentative(string caseTypeGroup =
public BookNewConferenceRequestBuilder WithIndividual(string caseTypeGroup = null)
{
var participant = Builder<ParticipantRequest>.CreateNew()
.With(x => x.Name = $"Automation {Name.FullName()}")
.With(x => x.Name = $"Automation_{Name.FullName()}")
.With(x => x.Username = $"Automation_{Internet.Email()}")
.With(x => x.DisplayName = $"Automation {Internet.UserName()}")
.With(x => x.DisplayName = $"Automation_{Internet.UserName()}")
.With(x => x.UserRole = UserRole.Individual)
.With(x => x.ParticipantRefId = Guid.NewGuid())
.Build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public class ParticipantRequestBuilder
public ParticipantRequestBuilder(UserRole userRole)
{
_participantRequest = Builder<ParticipantRequest>.CreateNew()
.With(x => x.Name = Name.FullName())
.With(x => x.Username = Internet.Email())
.With(x => x.DisplayName = Internet.UserName())
.With(x => x.Name = $"Automation_{Name.FullName()}")
.With(x => x.Username = $"Automation_{Internet.Email()}")
.With(x => x.DisplayName = $"Automation_{Internet.UserName()}")
.With(x => x.UserRole = userRole)
.Build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public ConferenceBuilder(bool ignoreId = false, Guid? knownHearingRefId = null,

var scheduleDateTime = scheduledDateTime ?? DateTime.UtcNow.AddMinutes(30);
const string caseType = "Civil Money Claims";
var caseNumber = $"Test{Guid.NewGuid():N}";
const string caseName = "Auto vs Manual";
var caseNumber = $"{GenerateRandom.CaseNumber(new Random())}";
const string caseName = "Video Api Integration Test";
const int scheduledDuration = 120;
_conference = new Conference(hearingRefId, caseType, scheduleDateTime, caseNumber, caseName, scheduledDuration);
}
Expand Down
1 change: 0 additions & 1 deletion VideoAPI/VideoApi.AcceptanceTests/Steps/CallbackSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Testing.Common.Helper;
using VideoApi.AcceptanceTests.Contexts;
using VideoApi.Common.Helpers;
using VideoApi.Common.Security.CustomToken;
using VideoApi.Contract.Requests;
using VideoApi.Contract.Responses;
using VideoApi.Domain.Enums;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void ThenTheParticipantIsAdded(string state)
_context.Response.IsSuccessful.Should().BeTrue();
var conference = ApiRequestHelper.DeserialiseSnakeCaseJsonToResponse<ConferenceDetailsResponse>(_context.Response.Content);
conference.Should().NotBeNull();
var exists = conference.Participants.Any(participant => participant.Username == _scenarioContext.Get<string>(ParticipantUsernameKey));
var exists = conference.Participants.Any(participant => participant.Username.ToLower().Equals(_scenarioContext.Get<string>(ParticipantUsernameKey).ToLower()));
if (state.Equals("added"))
{
exists.Should().BeTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void Setup()
[Test]
public async Task should_get_conference_for_username()
{
var username = "knownuser@email.com";
var username = "Automation_knownuser@email.com";
var conference1 = new ConferenceBuilder(true)
.WithParticipant(UserRole.Representative, "Defendant", username)
.WithParticipant(UserRole.Judge, null)
Expand Down
19 changes: 9 additions & 10 deletions VideoAPI/VideoApi.IntegrationTests/Steps/ParticipantSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Testing.Common.Helper.Builders.Api;
using VideoApi.Common.Helpers;
using VideoApi.Contract.Requests;
using VideoApi.Domain;
using VideoApi.Domain.Enums;
using VideoApi.IntegrationTests.Contexts;
using VideoApi.IntegrationTests.Helper;
Expand Down Expand Up @@ -93,9 +92,9 @@ public async Task GivenIHaveAnUpdateParticipantToConferenceRequest(Scenario scen
participantId = seededConference.Participants.First().Id;
request = new UpdateParticipantRequest
{
Fullname = "Mr Test_Fullname",
DisplayName = "Test_Displayname",
Representee = "Test_Representee"
Fullname = "Automation_Mr Test_Fullname",
DisplayName = "Automation_Test_Displayname",
Representee = "Automation_Test_Representee"
};
break;
}
Expand All @@ -105,18 +104,18 @@ public async Task GivenIHaveAnUpdateParticipantToConferenceRequest(Scenario scen
participantId = Guid.NewGuid();
request = new UpdateParticipantRequest
{
Fullname = "Mr Test_Fullname",
DisplayName = "Test_Displayname",
Representee = "Test_Representee"
Fullname = "Automation_Mr Test_Fullname",
DisplayName = "Automation_Test_Displayname",
Representee = "Automation_Test_Representee"
};
break;
case Scenario.Invalid:
conferenceId = Guid.Empty;
request = new UpdateParticipantRequest
{
Fullname = "Mr Test_Fullname",
DisplayName = "Test_Displayname",
Representee = "Test_Representee"
Fullname = "Automation_Mr Test_Fullname",
DisplayName = "Automation_Test_Displayname",
Representee = "Automation_Test_Representee"
};
break;

Expand Down

0 comments on commit f06c35b

Please sign in to comment.