aboutsummaryrefslogtreecommitdiffstats
path: root/tests.py
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-10-24 20:04:53 +0300
committerFilipp Lepalaan <filipp@mac.com>2016-10-24 20:04:53 +0300
commit7944e534b2388dfa511dea9f7185c115bfed6587 (patch)
tree7f6643024306314979a717097df6ed0d5548741e /tests.py
parent9443fcdd32abe4570e9ac427d859834a5d8be3a8 (diff)
downloadmachammer-7944e534b2388dfa511dea9f7185c115bfed6587.tar.gz
machammer-7944e534b2388dfa511dea9f7185c115bfed6587.tar.bz2
machammer-7944e534b2388dfa511dea9f7185c115bfed6587.zip
Added network module and tests
Diffstat (limited to 'tests.py')
-rwxr-xr-xtests.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests.py b/tests.py
index bec8125..02bcaf3 100755
--- a/tests.py
+++ b/tests.py
@@ -1,11 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+import time
import logging
import subprocess
from unittest import main, skip, TestCase
-import machammer.functions as mh
+from machammer import network
+from machammer import functions as mh
from machammer import system_profiler, screensaver
@@ -38,6 +40,28 @@ class SystemProfilerTestCase(TestCase):
self.assertTrue(build in system_profiler.get('Software', 'os_version'))
+class NetworkTestCase(TestCase):
+ def test_wifi_enable(self):
+ """Turn wifi power on, check that it's on"""
+ network.set_wifi_power(True)
+ time.sleep(3)
+ self.assertTrue(network.get_wifi_power())
+
+ def test_wired(self):
+ self.assertTrue(network.is_wired())
+
+ def test_wifi_disable(self):
+ network.set_wifi_power(False)
+ time.sleep(3)
+ self.assertTrue(not network.get_wifi_power())
+
+ def test_primary(self):
+ self.assertEqual(network.get_primary(), 'en4')
+
+ def test_primary_wired(self):
+ self.assertTrue(network.is_wired(True))
+
+
class AppsTestCase(TestCase):
def setUp(self):
self.profile = system_profiler.SystemProfile('Applications')
@@ -72,6 +96,10 @@ class FunctionsTestCase(TestCase):
p = mh.mount_image('/Users/filipp/Downloads/AdobeFlashPlayer_22au_a_install.dmg')
self.assertEquals(p, '/Volumes/Adobe Flash Player Installer')
+ @skip('This works, trust me.')
+ def test_sleep(self):
+ mh.sleep()
+
class ScreenSaverTestCase(TestCase):
def test_set_invalid(self):