Skip to content

Commit 2a3aff0

Browse files
committed
Fixed test #3440
1 parent d33bcbd commit 2a3aff0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/test/groovy/au/org/ala/merit/DownloadControllerSpec.groovy

+6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package au.org.ala.merit
22

33
import org.apache.http.HttpStatus
4+
import org.h2.engine.User
45
import org.springframework.mock.web.MockMultipartFile
56
import spock.lang.Specification
67
import grails.testing.web.controllers.ControllerUnitTest
78

89
class DownloadControllerSpec extends Specification implements ControllerUnitTest<DownloadController>{
910

1011
WebService webService = Mock(WebService)
12+
UserService userService = Mock(UserService)
1113
def setup() {
14+
controller.userService = userService
1215
controller.webService = webService
1316
}
1417

@@ -20,6 +23,7 @@ class DownloadControllerSpec extends Specification implements ControllerUnitTest
2023
def resp = controller.get()
2124

2225
then:
26+
1 * userService.userIsSiteAdmin() >> true
2327
1 * webService.proxyGetRequest(_, {it.endsWith('download/uuid1234')}, true, true, _) >> [status:HttpStatus.SC_OK]
2428

2529
and: "We return null to inform grails to not attempt to process a view as we are proxying a response from ecodata"
@@ -32,6 +36,7 @@ class DownloadControllerSpec extends Specification implements ControllerUnitTest
3236
controller.get()
3337

3438
then:
39+
1 * userService.userIsSiteAdmin() >> true
3540
response.status == HttpStatus.SC_BAD_REQUEST
3641
}
3742

@@ -45,6 +50,7 @@ class DownloadControllerSpec extends Specification implements ControllerUnitTest
4550
controller.get()
4651

4752
then:
53+
1 * userService.userIsSiteAdmin() >> true
4854
1 * webService.proxyGetRequest(_, {it.contains('download/file')}, true, true, _) >> {
4955
resp, url, userId, apiKey, timeout ->
5056
formatPassedToEcodata = url.endsWith(format)

0 commit comments

Comments
 (0)