emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 60d9d90 07/13: Added tests for interface selection


From: Ian Dunn
Subject: [elpa] master 60d9d90 07/13: Added tests for interface selection
Date: Sat, 15 Apr 2017 16:02:44 -0400 (EDT)

branch: master
commit 60d9d90841b90aa8019b554b5038e21156bedc64
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Added tests for interface selection
    
    * enwc-test.el (enwc-test-select-interface-save): Test for selecting 
interface
      using ip and saving the interface.
      (enwc-test-select-interface-no-save): Test for selecting interface using
      ifconfig and not saving the interface.
---
 enwc-test.el | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/enwc-test.el b/enwc-test.el
new file mode 100644
index 0000000..5b3c6f1
--- /dev/null
+++ b/enwc-test.el
@@ -0,0 +1,66 @@
+;;; enwc-test.el --- Tests for ENWC
+
+;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
+
+;; Author: Ian Dunn <address@hidden>
+;; Keywords: external, network, wicd, manager, nm
+;; Version: 2.0
+;; Package-Requires: ((emacs "25.1"))
+;; Homepage: https://savannah.nongnu.org/p/enwc
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'enwc)
+(require 'ert)
+
+;; Test enwc-setup
+
+(ert-deftest enwc-test-select-interface-save ()
+  ;; Test saving the interfaces and using the ip selection back-end
+  (let ((enwc-interface-list-function 'enwc--ip-interface-list)
+        (enwc-ask-to-save-interfaces t)
+        ;; Temporarily save our changes to a different file
+        (custom-file (make-temp-file "enwc-custom-"))
+        (enwc-wired-device "")
+        (enwc-wireless-device ""))
+    (enwc--setup-select-interfaces)
+    (should (not (string-empty-p enwc-wired-device)))
+    (should (not (string-empty-p enwc-wireless-device)))
+    ;; Test whether the interfaces were saved
+    (let ((enwc-wired-device "")
+          (enwc-wireless-device ""))
+      (load custom-file)
+      (should (not (string-empty-p enwc-wired-device)))
+      (should (not (string-empty-p enwc-wireless-device))))
+    ;; Delete our temporary custom file
+    (delete-file custom-file)))
+
+(ert-deftest enwc-test-select-interface-no-save ()
+  ;; Test not saving the interfaces and using the ifconfig selection back-end
+  (let ((enwc-interface-list-function 'enwc--ifconfig-interface-list)
+        (enwc-ask-to-save-interfaces nil)
+        ;; Temporarily save our "changes" to a different file
+        (custom-file (make-temp-file "enwc-custom-"))
+        (enwc-wired-device "")
+        (enwc-wireless-device ""))
+    (enwc--setup-select-interfaces)
+    (should (not (string-empty-p enwc-wired-device)))
+    (should (not (string-empty-p enwc-wireless-device)))
+    ;; Test whether the interfaces were saved
+    (let ((enwc-wired-device "")
+          (enwc-wireless-device ""))
+      (load custom-file)
+      (should (string-empty-p enwc-wired-device))
+      (should (string-empty-p enwc-wireless-device)))
+    ;; Delete our temporary custom file
+    (delete-file custom-file)))
+
+(provide 'enwc-test)
+
+;; Local Variables:
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; End:
+;;; enwc-test.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]