@@ -658,6 +658,9 @@ func TestGetEditionReturnsOK(t *testing.T) {
658658 GetDatasetTypeFunc : func (context.Context , string , bool ) (string , error ) {
659659 return models .CantabularFlexibleTable .String (), nil
660660 },
661+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
662+ return nil , 0 , nil
663+ },
661664 }
662665
663666 authorisationMock := & authMock.MiddlewareMock {
@@ -682,6 +685,7 @@ func TestGetEditionReturnsOK(t *testing.T) {
682685 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 1 )
683686 So (len (mockedDataStore .GetEditionCalls ()), ShouldEqual , 1 )
684687 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 0 )
688+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
685689 })
686690
687691 Convey ("A successful request to get edition when dataset is static returns 200 OK response" , t , func () {
@@ -697,6 +701,9 @@ func TestGetEditionReturnsOK(t *testing.T) {
697701 GetLatestVersionStaticFunc : func (context.Context , string , string , string ) (* models.Version , error ) {
698702 return exampleStaticVersion , nil
699703 },
704+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
705+ return nil , 0 , nil
706+ },
700707 }
701708
702709 authorisationMock := & authMock.MiddlewareMock {
@@ -721,6 +728,7 @@ func TestGetEditionReturnsOK(t *testing.T) {
721728 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 1 )
722729 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 2 )
723730 So (len (mockedDataStore .GetEditionCalls ()), ShouldEqual , 0 )
731+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
724732 })
725733}
726734
@@ -736,6 +744,9 @@ func TestGetEditionReturnsError(t *testing.T) {
736744 GetDatasetTypeFunc : func (context.Context , string , bool ) (string , error ) {
737745 return "" , errs .ErrInternalServer
738746 },
747+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
748+ return nil , 0 , nil
749+ },
739750 }
740751
741752 authorisationMock := & authMock.MiddlewareMock {
@@ -755,6 +766,7 @@ func TestGetEditionReturnsError(t *testing.T) {
755766 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 0 )
756767 So (len (mockedDataStore .GetEditionCalls ()), ShouldEqual , 0 )
757768 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 0 )
769+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
758770 })
759771
760772 Convey ("When the dataset does not exist return status not found" , t , func () {
@@ -768,6 +780,9 @@ func TestGetEditionReturnsError(t *testing.T) {
768780 GetDatasetTypeFunc : func (context.Context , string , bool ) (string , error ) {
769781 return "" , errs .ErrDatasetNotFound
770782 },
783+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
784+ return nil , 0 , nil
785+ },
771786 }
772787
773788 authorisationMock := & authMock.MiddlewareMock {
@@ -787,6 +802,7 @@ func TestGetEditionReturnsError(t *testing.T) {
787802 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 0 )
788803 So (len (mockedDataStore .GetEditionCalls ()), ShouldEqual , 0 )
789804 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 0 )
805+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
790806 })
791807
792808 Convey ("When edition does not exist for a dataset return status not found" , t , func () {
@@ -803,6 +819,9 @@ func TestGetEditionReturnsError(t *testing.T) {
803819 GetEditionFunc : func (context.Context , string , string , string ) (* models.EditionUpdate , error ) {
804820 return nil , errs .ErrEditionNotFound
805821 },
822+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
823+ return nil , 0 , nil
824+ },
806825 }
807826
808827 authorisationMock := & authMock.MiddlewareMock {
@@ -822,6 +841,7 @@ func TestGetEditionReturnsError(t *testing.T) {
822841 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 1 )
823842 So (len (mockedDataStore .GetEditionCalls ()), ShouldEqual , 1 )
824843 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 0 )
844+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
825845 })
826846
827847 Convey ("When edition is not published for a dataset return status not found" , t , func () {
@@ -837,6 +857,9 @@ func TestGetEditionReturnsError(t *testing.T) {
837857 GetEditionFunc : func (context.Context , string , string , string ) (* models.EditionUpdate , error ) {
838858 return nil , errs .ErrEditionNotFound
839859 },
860+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
861+ return nil , 0 , nil
862+ },
840863 }
841864
842865 authorisationMock := & authMock.MiddlewareMock {
@@ -856,6 +879,7 @@ func TestGetEditionReturnsError(t *testing.T) {
856879 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 1 )
857880 So (len (mockedDataStore .GetEditionCalls ()), ShouldEqual , 1 )
858881 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 0 )
882+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
859883 })
860884
861885 Convey ("When dataset is static and version does not exist return status not found" , t , func () {
@@ -871,6 +895,9 @@ func TestGetEditionReturnsError(t *testing.T) {
871895 GetLatestVersionStaticFunc : func (context.Context , string , string , string ) (* models.Version , error ) {
872896 return nil , errs .ErrVersionNotFound
873897 },
898+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
899+ return nil , 0 , nil
900+ },
874901 }
875902
876903 authorisationMock := & authMock.MiddlewareMock {
@@ -890,6 +917,7 @@ func TestGetEditionReturnsError(t *testing.T) {
890917 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 1 )
891918 So (len (mockedDataStore .GetEditionCalls ()), ShouldEqual , 0 )
892919 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 1 )
920+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
893921 })
894922}
895923
@@ -965,6 +993,9 @@ func TestGetEditionRecordsAuditEvent(t *testing.T) {
965993 }
966994 return unpublishedVersion , nil
967995 },
996+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
997+ return nil , 0 , nil
998+ },
968999 }
9691000
9701001 auditServiceMock := & applicationMocks.AuditServiceMock {
@@ -1009,6 +1040,7 @@ func TestGetEditionRecordsAuditEvent(t *testing.T) {
10091040 So (len (mockedDataStore .IsStaticDatasetCalls ()), ShouldEqual , 1 )
10101041 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 1 )
10111042 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 2 )
1043+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
10121044 })
10131045 })
10141046 })
@@ -1060,6 +1092,9 @@ func TestGetEditionRecordsAuditEventWithPublishedVersionOnly(t *testing.T) {
10601092 }
10611093 return nil , errs .ErrVersionNotFound
10621094 },
1095+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
1096+ return nil , 0 , nil
1097+ },
10631098 }
10641099
10651100 auditServiceMock := & applicationMocks.AuditServiceMock {
@@ -1146,6 +1181,9 @@ func TestGetEditionDoesNotRecordAuditEventForUnauthorisedUser(t *testing.T) {
11461181 GetLatestVersionStaticFunc : func (ctx context.Context , datasetID , editionID , state string ) (* models.Version , error ) {
11471182 return publishedVersion , nil
11481183 },
1184+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
1185+ return nil , 0 , nil
1186+ },
11491187 }
11501188
11511189 auditServiceMock := & applicationMocks.AuditServiceMock {
@@ -1183,6 +1221,7 @@ func TestGetEditionDoesNotRecordAuditEventForUnauthorisedUser(t *testing.T) {
11831221 So (len (mockedDataStore .IsStaticDatasetCalls ()), ShouldEqual , 1 )
11841222 So (len (mockedDataStore .GetDatasetTypeCalls ()), ShouldEqual , 1 )
11851223 So (len (mockedDataStore .GetLatestVersionStaticCalls ()), ShouldEqual , 1 )
1224+ So (len (mockedDataStore .GetVersionsStaticByEditionNoLimitCalls ()), ShouldEqual , 1 )
11861225 })
11871226 })
11881227 })
@@ -1234,6 +1273,9 @@ func TestGetEditionAuditEventLogsErrorButContinues(t *testing.T) {
12341273 }
12351274 return nil , errs .ErrVersionNotFound
12361275 },
1276+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
1277+ return nil , 0 , nil
1278+ },
12371279 }
12381280
12391281 auditServiceMock := & applicationMocks.AuditServiceMock {
@@ -1312,6 +1354,9 @@ func TestGetEditionReturnsIsMigration(t *testing.T) {
13121354 GetLatestVersionStaticFunc : func (ctx context.Context , datasetID , editionID , state string ) (* models.Version , error ) {
13131355 return publishedVersion , nil
13141356 },
1357+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
1358+ return nil , 0 , nil
1359+ },
13151360 }
13161361
13171362 Convey ("When an unauthenticated user calls the GET edition endpoint" , func () {
@@ -1422,6 +1467,9 @@ func TestGetEditionReturnsIsMigration(t *testing.T) {
14221467 GetLatestVersionStaticFunc : func (ctx context.Context , datasetID , editionID , state string ) (* models.Version , error ) {
14231468 return publishedVersion , nil
14241469 },
1470+ GetVersionsStaticByEditionNoLimitFunc : func (ctx context.Context , datasetID string , edition string , state string ) ([]* models.Version , int , error ) {
1471+ return nil , 0 , nil
1472+ },
14251473 }
14261474
14271475 authorisationMock := & authMock.MiddlewareMock {
0 commit comments