[gnome-battery-bench] integration-test: check 'Unknown' for missing vals



commit c0cce11ed921d522675b3dce388862be1b26d9cf
Author: Christian Kellner <christian kellner me>
Date:   Sun Apr 2 21:06:30 2017 +0200

    integration-test: check 'Unknown' for missing vals
    
    If the corresponding sys devices/entries are missing we should
    still get 'Unknown' in the fields, but the fields should be
    present.

 src/integration-test |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/integration-test b/src/integration-test
index 78c507c..0c93caf 100755
--- a/src/integration-test
+++ b/src/integration-test
@@ -190,6 +190,28 @@ class Tests(unittest.TestCase):
         return ac, b0
 
     def test_basic(self):
+        '''Basic system information (model, bios, etc)
+
+        In the first run we ensure that we get 'Unknown' for all
+        fields that we haven't set in /sys, then we fill them for them
+        second run and check we get the right values
+        '''
+        log = self.gbb("info", ["--json"])
+        out = json.loads(log)
+
+        self.assertIn('hardware', out)
+        hw = out['hardware']
+        for key in ['vendor', 'version', 'name']:
+            self.assertEqual(hw[key], 'Unknown')
+        self.assertIn('bios', hw)
+        bios = hw['bios']
+        for key in ['vendor', 'version', 'date']:
+            self.assertEqual(bios[key], 'Unknown')
+
+        self.assertIn('batteries', hw)
+        self.assertEqual(len(hw['batteries']), 0)
+
+        # now with devices in /sys/
         vendor = 'GNOME.org'
         model = 'B1'
 


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