Skip to content

Commit ec687f6

Browse files
Tests for creating/retrieving metadata revisions
1 parent 350fd8a commit ec687f6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/HighLevelTest.hs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ doit root
8383
unless (db1 == db2) $ die "Databases don't match"
8484
info "Checking server still works, and data is intact"
8585
withServerRunning root runPackageTests
86+
withServerRunning root runRevisionTests
8687

8788

8889
runUserTests :: IO ()
@@ -191,6 +192,23 @@ runPackageUploadTests = do
191192
uploadTimeISO = "2010-10-18T20:54:28Z"
192193
uploadTimeISO2 = "2020-10-18T20:54:28Z"
193194

195+
runRevisionTests :: IO ()
196+
runRevisionTests = do
197+
do info "Revising testpackage"
198+
post (Auth "HackageTestUser1" "testpass1") "/package/testpackage-1.0.0.0/testpackage.cabal/edit"
199+
[ ("cabalfile", revisedCabalFileContent)
200+
, ("publish", "Publish new revision")
201+
]
202+
do info "Checking revision exists"
203+
xs <- getUrl NoAuth "/package/testpackage-1.0.0.0/revision/1.cabal"
204+
unless (xs == revisedCabalFileContent) $
205+
die "Bad revised cabal file content"
206+
where
207+
(_, _, _, testpackageCabalFileContent, _, _) = testpackage
208+
revisedCabalFileContent =
209+
"x-revision: 1\ndescription: a description added by revision\n"
210+
++ testpackageCabalFileContent
211+
194212
runPackageTests :: IO ()
195213
runPackageTests = do
196214
do info "Getting package list"

0 commit comments

Comments
 (0)