1
0
Fork 0
Browse Source

add tests which validate the /status/latest call.

The URL which returns the latest status for all the devices at once is
validated. The tests are not extensive. They just check to make sure
all the intended device are present and the last device on the list is
'device 6'. If any of the device names change or 'device 6' is not the
last device, it means the API has changed.
unstable
Craig Oates 3 years ago
parent
commit
d6f93b022d
  1. 14
      tests/main.lisp

14
tests/main.lisp

@ -239,3 +239,17 @@
;; data (manually most likely) which should result in this failing
;; because Ratify will return the parsed timestamp and not `NIL'.
(is (equal (ratify:datetime-p (cdaddr data)) nil)))) ; time value.
(fiveam:test all-device-status-data
:description "Validates the status data produced when all status
data for all devices is requested in the same API call."
(let ((data (ritherdon-rest:parse-request "/status/latest")))
(is (= 6 (length data)))
(is-true (consp data))
(is (equal ':|DEVICE 1| (car (first data))))
(is (equal ':|DEVICE 2| (car (second data))))
(is (equal ':|DEVICE 3| (car (third data))))
(is (equal ':|DEVICE 4| (car (fourth data))))
(is (equal ':|DEVICE 5| (car (fifth data))))
;; if 6 not last a big change has occurred.
(is (equal ':|DEVICE 6| (caar (last data))))))