Selaa lähdekoodia

More config fixes

oz123 10 vuotta sitten
vanhempi
commit
921ad2c236
3 muutettua tiedostoa jossa 12 lisäystä ja 14 poistoa
  1. 10 12
      pwman/tests/test_config.py
  2. 1 1
      pwman/util/config.py
  3. 1 1
      scripts/pwman3

+ 10 - 12
pwman/tests/test_config.py

@@ -1,4 +1,4 @@
-#============================================================================
+# ============================================================================
 # This file is part of Pwman3.
 #
 # Pwman3 is free software; you can redistribute it and/or modify
@@ -13,9 +13,9 @@
 # You should have received a copy of the GNU General Public License
 # along with Pwman3; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#============================================================================
+# ============================================================================
 # Copyright (C) 2014 Oz Nahum Tiram <nahumoz@gmail.com>
-#============================================================================
+# ============================================================================
 
 import os
 import sys
@@ -43,15 +43,6 @@ type = SQLite
 
 class TestConfig(unittest.TestCase):
 
-    @staticmethod
-    def clean_all():
-        for item in ('testfile.conf', 'wrong_conf.conf', 'dummy.cfg',
-                     'import_file.csv'):
-            try:
-                os.unlink(item)
-            except OSError:
-                continue
-
     @classmethod
     def tearDownClass(cls):
         for item in ('testfile.conf', 'wrong_conf.conf', 'dummy.cfg',
@@ -101,5 +92,12 @@ algorithm = Blowfish
         ans = config.get_pass_conf(self.conf)
         self.assertFalse(any(ans))
 
+    def test_open_file(self):
+        cfg = config.Config("DoesNotExist")
+        cfg.save()
+        self.assertTrue(os.path.exists("DoesNotExist"))
+        os.unlink("DoesNotExist")
+
+
 if __name__ == '__main__':
     unittest.main(verbosity=2)

+ 1 - 1
pwman/util/config.py

@@ -110,7 +110,7 @@ class Config(object):
             self.parser.write(fp)
 
 
-def get_pass_conf(config):  # pragma: no cover
+def get_pass_conf(config):
     ascii_lowercase = config.get_value("Generator",
                                        "ascii_lowercase").lower() == 'true'
     ascii_uppercase = config.get_value("Generator",

+ 1 - 1
scripts/pwman3

@@ -54,7 +54,7 @@ def main(args):
     except KeyboardInterrupt as e:
         print(e)
     finally:
-        config.save(args.cfile)
+        config.save()
 
 if __name__ == '__main__':
     args = parser_options().parse_args()