This repository was archived by the owner on Mar 25, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
context(" Test the otp_connect function" )
4
4
5
+ test_that(" default object is created and make_url method works" , {
6
+ otpcon <- otp_connect(check = FALSE )
7
+ expect_is(otpcon , " otpconnect" )
8
+ expect_match(make_url(otpcon ), " http://localhost:8080/otp/routers/default" )
9
+ })
10
+
11
+ # the following tests require an OTP instance at http://localhost:8080/otp with "default" router
12
+
13
+ test_that(" object returned when check is TRUE and router exists" , {
14
+ otpcon <- otp_connect()
15
+ expect_is(otpcon , " otpconnect" )
16
+ })
17
+
18
+ test_that(" correct message when check is TRUE and router exists" , {
19
+ expect_message(otp_connect(), " Router http://localhost:8080/otp/routers/default exists" )
20
+ })
21
+
22
+
23
+ test_that(" object is not returned when check is TRUE and router does not exist" , {
24
+ # otpcon <- otp_connect(router = "test")
25
+ expect_false(exists(" otpcon" ))
26
+ })
27
+
28
+ test_that(" correct error when check is TRUE and router does not exist" , {
29
+ expect_error(otp_connect(router = " test" ), " Router http://localhost:8080/otp/routers/test does not exist" )
30
+ })
31
+
You can’t perform that action at this time.
0 commit comments