emacs-ipython-notebook/test/test-ein-notebooklist.el
dickmao d621944797 Clean up websocket callbacks
Coursera appears to kill websockets every minute or so, and I'm
observing firsthand the buggy behaviors described in #356.  This PR
cleans up the websocket code and kernel restart logic.  Removed
backwards compatibility for the v2 messaging api
as keeping it in the presence of the refactoring would make it more
broken that it already was.
2018-10-31 23:38:45 -04:00

28 lines
1.2 KiB
EmacsLisp
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(require 'ein-notebooklist)
(require 'ein-testing-notebook)
(defun eintest:notebooklist-make-empty (&optional url-or-port)
"Make empty notebook list buffer."
(cl-letf (((symbol-function 'ein:need-kernelspecs) #'ignore)
((symbol-function 'ein:content-query-sessions) #'ignore))
(ein:notebooklist-open--finish (or url-or-port ein:testing-notebook-dummy-url) nil
(make-ein:$content :url-or-port (or url-or-port ein:testing-notebook-dummy-url)
:notebook-version 3
:path ""))))
(defmacro eintest:notebooklist-is-empty-context-of (func)
`(ert-deftest ,(intern (format "%s--notebooklist" func)) ()
(with-current-buffer (eintest:notebooklist-make-empty)
(should-not (,func)))))
;; Generic getter
(ert-deftest ein:get-url-or-port--notebooklist ()
(with-current-buffer (eintest:notebooklist-make-empty)
(should (equal (ein:get-url-or-port) ein:testing-notebook-dummy-url))))
(eintest:notebooklist-is-empty-context-of ein:get-notebook)
(eintest:notebooklist-is-empty-context-of ein:get-kernel)
(eintest:notebooklist-is-empty-context-of ein:get-cell-at-point)
(eintest:notebooklist-is-empty-context-of ein:get-traceback-data)