Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EES-5658 Swap usages of Year, TimePeriodCoverage and Slug from ReleaseVersion to Release #5553

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -612,8 +612,9 @@ await TestApp.AddTestData<ContentDbContext>(
var releaseVersion = Assert.Single(release.Versions);
Assert.Equal(publication.Id, releaseVersion.PublicationId);
Assert.Equal(release.Id, releaseVersion.ReleaseId);

// TODO EES-5659 - Remove the ReleaseVersion assertions on ReleaseName, TimePeriodCoverage, Slug
Assert.Equal(year.ToString(), releaseVersion.ReleaseName);
Assert.Equal(year, releaseVersion.Year);
Assert.Equal(timePeriodCoverage, releaseVersion.TimePeriodCoverage);
Assert.Equal(expectedSlug, releaseVersion.Slug);

Expand Down Expand Up @@ -817,8 +818,9 @@ await TestApp.AddTestData<ContentDbContext>(
var releaseVersion = Assert.Single(release.Versions);
Assert.Equal(publication.Id, releaseVersion.PublicationId);
Assert.Equal(release.Id, releaseVersion.ReleaseId);

// TODO EES-5659 - Remove the ReleaseVersion assertions on ReleaseName, TimePeriodCoverage, Slug
Assert.Equal(newYear.ToString(), releaseVersion.ReleaseName);
Assert.Equal(newYear, releaseVersion.Year);
Assert.Equal(newTimePeriodCoverage, releaseVersion.TimePeriodCoverage);
Assert.Equal(expectedNewSlug, releaseVersion.Slug);

Expand Down Expand Up @@ -875,6 +877,7 @@ await TestApp.AddTestData<ContentDbContext>(
Assert.Equal(expectedNewLabel, release.Label);
Assert.Equal(expectedNewSlug, release.Slug);

// TODO EES-5659 - Remove the assertion on ReleaseVersion.Slug
var releaseVersion = Assert.Single(release.Versions);
Assert.Equal(expectedNewSlug, releaseVersion.Slug);
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public async Task CreateReleaseAmendment()
.DefaultReleaseVersion()
.WithRelease(_fixture
.DefaultRelease()
.WithYear(2035)
.WithTimePeriodCoverage(TimeIdentifier.March)
.WithPublication(_fixture
.DefaultPublication()))
.WithCreated(
Expand All @@ -70,13 +72,11 @@ public async Task CreateReleaseAmendment()
.WithPublished(DateTime.UtcNow.AddDays(-1))
.WithApprovalStatus(ReleaseApprovalStatus.Approved)
.WithPreviousVersionId(Guid.NewGuid())
.WithYear(2035)
.WithType(ReleaseType.OfficialStatistics)
.WithReleaseStatuses(_fixture
.DefaultReleaseStatus()
.Generate(1))
.WithVersion(2)
.WithTimePeriodCoverage(TimeIdentifier.March)
.WithNotifiedOn(DateTime.UtcNow.AddDays(-4))
.WithNotifySubscribers(true)
.WithUpdatePublishedDate(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1787,19 +1787,9 @@ public async Task Upload()
const string dataFileName = "test-data.csv";
const string metaFileName = "test-data.meta.csv";

var releaseVersion = new ReleaseVersion
{
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
}
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var contentDbContextId = Guid.NewGuid().ToString();
var statisticsDbContextId = Guid.NewGuid().ToString();
Expand Down Expand Up @@ -1927,19 +1917,9 @@ public async Task Upload_Replacing()
const string dataFileName = "test-data.csv";
const string metaFileName = "test-data.meta.csv";

var releaseVersion = new ReleaseVersion
{
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
}
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var originalSubject = new Subject
{
Expand Down Expand Up @@ -2143,19 +2123,9 @@ public async Task Upload_Order()
const string dataFileName = "test-data.csv";
const string metaFileName = "test-data.meta.csv";

var releaseVersion = new ReleaseVersion
{
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
},
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var releaseFiles = new List<ReleaseFile>
{
Expand Down Expand Up @@ -2296,20 +2266,9 @@ public async Task UploadAsZip()
const string metaFileName = "test-data.meta.csv";
const string zipFileName = "test-data-archive.zip";

var releaseVersion = new ReleaseVersion
{
Id = Guid.NewGuid(),
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
}
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var contentDbContextId = Guid.NewGuid().ToString();
var statisticsDbContextId = Guid.NewGuid().ToString();
Expand Down Expand Up @@ -2443,20 +2402,9 @@ public async Task UploadAsZip_Order()
const string metaFileName = "test-data.meta.csv";
const string zipFileName = "test-data-archive.zip";

var releaseVersion = new ReleaseVersion
{
Id = Guid.NewGuid(),
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
}
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var releaseFiles = new List<ReleaseFile>
{
Expand Down Expand Up @@ -2592,19 +2540,9 @@ public async Task UploadAsZip_Replacing()
const string metaFileName = "test-data.meta.csv";
const string zipFileName = "test-data-archive.zip";

var releaseVersion = new ReleaseVersion
{
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
}
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var originalSubject = new Subject
{
Expand Down Expand Up @@ -2786,20 +2724,9 @@ public async Task UploadAsZip_Replacing()
public async Task ValidateAndUploadBulkZip_InvalidZipFile_ReturnsValidationResult()
{
// Arrange
var releaseVersion = new ReleaseVersion
{
Id = Guid.NewGuid(),
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
}
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var contentDbContextId = Guid.NewGuid().ToString();

Expand Down Expand Up @@ -2839,20 +2766,9 @@ public async Task ValidateAndUploadBulkZip_InvalidZipFile_ReturnsValidationResul
[Fact]
public async Task ValidateAndUploadBulkZip()
{
var releaseVersion = new ReleaseVersion
{
Id = Guid.NewGuid(),
ReleaseName = "2000",
Publication = new Publication
{
Title = "Test publication",
Theme = new Theme
{
Id = Guid.NewGuid(),
Title = "Test theme"
}
}
};
ReleaseVersion releaseVersion = _fixture.DefaultReleaseVersion()
.WithRelease(_fixture.DefaultRelease()
.WithPublication(_fixture.DefaultPublication()));

var contentDbContextId = Guid.NewGuid().ToString();

Expand Down
Loading
Loading