forked from PecanProject/pecan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.models.R
33 lines (29 loc) · 987 Bytes
/
test.models.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
context("Testing all models endpoints")
test_that("Calling /api/models/ returns Status 200", {
res <- httr::GET(
"http://pecan.localhost/api/models/?model_name=SIPNET&revision=ssr",
httr::authenticate("carya", "illinois")
)
expect_equal(res$status, 200)
})
test_that("Calling /api/models/ with invalid parameters returns Status 404", {
res <- httr::GET(
"http://pecan.localhost/api/models/?model_name=random&revision=random",
httr::authenticate("carya", "illinois")
)
expect_equal(res$status, 404)
})
test_that("Calling /api/models/{model_id} returns Status 200", {
res <- httr::GET(
"http://pecan.localhost/api/models/1000000014",
httr::authenticate("carya", "illinois")
)
expect_equal(res$status, 200)
})
test_that("Calling /api/models/{model_id} with invalid parameters returns Status 404", {
res <- httr::GET(
"http://pecan.localhost/api/models/1",
httr::authenticate("carya", "illinois")
)
expect_equal(res$status, 404)
})