コード例 #1
0
ファイル: test_factory.py プロジェクト: pwman3/pwman3
 def test_factory_createdb_postgresql(self):
     db = factory.createdb("postgresql:///pwman", 0.6)
     self.assertIsInstance(db, PostgresqlDatabase)
     del db
     db = factory.createdb("postgresql:///pwman", 0.7)
     self.assertIsInstance(db, PostgresqlDatabase)
     del db
コード例 #2
0
 def test_factory_createdb_postgresql(self):
     db = factory.createdb("postgresql:///pwman", 0.6)
     self.assertIsInstance(db, PostgresqlDatabase)
     del db
     db = factory.createdb("postgresql:///pwman", 0.7)
     self.assertIsInstance(db, PostgresqlDatabase)
     del db
コード例 #3
0
ファイル: test_factory.py プロジェクト: pwman3/pwman3
 def test_factory_createdb(self):
     db = factory.createdb("sqlite:///test.db", 0.6)
     self.assertIsInstance(db, SQLite)
     del db
     db = factory.createdb("sqlite:///test.db", 0.7)
     self.assertIsInstance(db, SQLite)
     del db
コード例 #4
0
 def test_factory_createdb(self):
     db = factory.createdb("sqlite:///test.db", 0.6)
     self.assertIsInstance(db, SQLite)
     del db
     db = factory.createdb("sqlite:///test.db", 0.7)
     self.assertIsInstance(db, SQLite)
     del db
コード例 #5
0
ファイル: test_init.py プロジェクト: yujingjiangshui9/pwman3
 def setUp(self):
     "test that the right db instance was created"
     self.dbtype = 'sqlite'
     self.db = factory.createdb('sqlite://' + os.path.abspath(testdb),
                                __DB_FORMAT__)
     self.tester = SetupTester(__DB_FORMAT__, dburi=testdb)
     self.tester.create()
コード例 #6
0
ファイル: test_init.py プロジェクト: gadeleon/pwman3
 def setUp(self):
     "test that the right db instance was created"
     self.dbtype = 'sqlite'
     self.db = factory.createdb('sqlite://' + os.path.abspath(testdb),
                                __DB_FORMAT__)
     self.tester = SetupTester(__DB_FORMAT__, dburi=testdb)
     self.tester.create()
コード例 #7
0
ファイル: cli.py プロジェクト: gadeleon/pwman3
def main():
    args = parser_options().parse_args()
    PwmanCli, OSX = get_ui_platform(sys.platform)
    xselpath, dbtype, config = get_conf_options(args, OSX)
    dburi = config.get_value('Database', 'dburi')
    print(dburi)
    dbver = get_db_version(config, args)
    CryptoEngine.get()


    db = factory.createdb(dburi, dbver)

    if args.import_file:
        importer = Importer((args, config, db))
        importer.run()
        sys.exit(0)

    cli = PwmanCli(db, xselpath, CLICallback, config)

    try:
        cli.cmdloop()
    except KeyboardInterrupt as e:
        print(e)
    finally:
        config.save()
コード例 #8
0
ファイル: cli.py プロジェクト: pwman3/pwman3
def main():
    args = parser_options().parse_args()
    PwmanCli, OSX = get_ui_platform(sys.platform)
    xselpath, dbtype, config = get_conf_options(args, OSX)
    dburi = config.get_value('Database', 'dburi')

    client_info = config.get_value('Updater', 'client_info')

    if not client_info:
        client_info = calculate_client_info()
        config.set_value('Updater', 'client_info', client_info)

    if not has_cryptography:
        import colorama
        if config.get_value('Crypto', 'supress_warning').lower() != 'yes':
            print("{}WARNING: You are not using PyCrypto!!!\n"
                  "WARNING: You should install PyCrypto for better security and "  # noqa
                  "perfomance\nWARNING: You can supress this warning by editing "  # noqa
                  "pwman config file.{}".format(colorama.Fore.RED,
                                                colorama.Style.RESET_ALL))

    if args.cmd == "version":
        latest = check_version(version, client_info)
        print("version: %s is latest: %s" % (version, latest))
        sys.exit(0)

    elif config.get_value('Updater',
                          'supress_version_check').lower() != 'yes':
        check_version(version, client_info)

    print(dburi)
    dbver = get_db_version(config, args)
    timeout = int(config.get_value('Global', 'lock_timeout'))
    CryptoEngine.get(timeout)

    db = factory.createdb(dburi, dbver)

    if args.file_delim:
        importer = Importer((args, config, db))
        importer.run()
        sys.exit(0)

    cli = PwmanCli(db, xselpath, CLICallback, config)

    if args.cmd == "p":
        cli.onecmd("pp %s" % args.node)
        sys.exit(0)

    if args.cmd == "cp":
        cli.onecmd("cp %s" % args.node)
        sys.exit(0)

    try:
        cli.cmdloop()
    except KeyboardInterrupt as e:
        print(e)
    finally:
        config.save()
コード例 #9
0
ファイル: cli.py プロジェクト: yujingjiangshui9/pwman3
def main():
    args = parser_options().parse_args()
    PwmanCli, OSX = get_ui_platform(sys.platform)
    xselpath, dbtype, config = get_conf_options(args, OSX)
    dburi = config.get_value('Database', 'dburi')

    client_info = config.get_value('Updater', 'client_info')

    if not client_info:
        client_info = calculate_client_info()
        config.set_value('Updater', 'client_info', client_info)

    if not has_cryptography:
        import colorama
        if config.get_value('Crypto', 'supress_warning').lower() != 'yes':
            print(
                "{}WARNING: You are not using PyCrypto!!!\n"
                "WARNING: You should install PyCrypto for better security and "  # noqa
                "perfomance\nWARNING: You can supress this warning by editing "  # noqa
                "pwman config file.{}".format(colorama.Fore.RED,
                                              colorama.Style.RESET_ALL))

    if args.cmd == "version":
        latest = check_version(version, client_info)
        print("version: %s is latest: %s" % (version, latest))
        sys.exit(0)

    elif config.get_value('Updater', 'supress_version_check').lower() != 'yes':
        check_version(version, client_info)

    print(dburi)
    dbver = get_db_version(config, args)
    timeout = int(config.get_value('Global', 'lock_timeout'))
    CryptoEngine.get(timeout)

    db = factory.createdb(dburi, dbver)

    if args.file_delim:
        importer = Importer((args, config, db))
        importer.run()
        sys.exit(0)

    cli = PwmanCli(db, xselpath, CLICallback, config)

    if args.cmd == "p":
        cli.onecmd("pp %s" % args.node)
        sys.exit(0)

    if args.cmd == "cp":
        cli.onecmd("cp %s" % args.node)
        sys.exit(0)

    try:
        cli.cmdloop()
    except KeyboardInterrupt as e:
        print(e)
    finally:
        config.save()
コード例 #10
0
ファイル: test_factory.py プロジェクト: donnm/pwman3
 def test_factory_create(self):
     fn = os.path.join(os.path.dirname(__file__), 'foo.db')
     db = factory.createdb('sqlite://' + os.path.abspath(fn), 0.6)
     db._open()
     self.assertTrue(os.path.exists(fn))
     db.close()
     os.unlink(fn)
     self.assertIsInstance(db, SQLite)
     self.assertRaises(DatabaseException, factory.createdb,
                       *('UNKNOWN', __DB_FORMAT__))
コード例 #11
0
ファイル: test_factory.py プロジェクト: gadeleon/pwman3
 def test_factory_create(self):
     fn = os.path.join(os.path.dirname(__file__), 'foo.db')
     db = factory.createdb('sqlite://'+os.path.abspath(fn), 0.6)
     db._open()
     self.assertTrue(os.path.exists(fn))
     db.close()
     os.unlink(fn)
     self.assertIsInstance(db, SQLite)
     self.assertRaises(DatabaseException, factory.createdb, *('UNKNOWN',
                                                              __DB_FORMAT__))
コード例 #12
0
ファイル: test_factory.py プロジェクト: donnm/pwman3
 def test_factory_check_db_file(self):
     fn = os.path.join(os.path.dirname(__file__), 'baz.db')
     db = factory.createdb('sqlite:///' + os.path.abspath(fn), 0.3)
     db._open()
     self.assertEqual(factory.check_db_version('sqlite:///' + fn), 0.3)
     os.unlink(fn)
コード例 #13
0
 def setUp(self):
     "test that the right db instance was created"
     dbver = __DB_FORMAT__
     self.db = factory.createdb('sqlite://' + testdb, dbver)
     self.tester = SetupTester(dbver, testdb)
     self.tester.create()
コード例 #14
0
ファイル: test_tools.py プロジェクト: gadeleon/pwman3
 def create(self):
     db = factory.createdb(self.dburi, self.dbver)
     self.cli = PwmanCliNew(db, self.xselpath, DummyCallback,
                            config_parser=self.configp)
コード例 #15
0
ファイル: test_tools.py プロジェクト: yujingjiangshui9/pwman3
 def create(self):
     db = factory.createdb(self.dburi, self.dbver)
     self.cli = PwmanCliNew(db,
                            self.xselpath,
                            DummyCallback,
                            config_parser=self.configp)
コード例 #16
0
ファイル: test_factory.py プロジェクト: gadeleon/pwman3
 def setUp(self):
     "test that the right db instance was created"
     self.dbtype = 'sqlite'
     self.db = factory.createdb('sqlite:///'+testdb, __DB_FORMAT__)
     self.tester = SetupTester(__DB_FORMAT__, testdb)
     self.tester.create()
コード例 #17
0
ファイル: test_factory.py プロジェクト: donnm/pwman3
 def setUp(self):
     "test that the right db instance was created"
     self.dbtype = 'sqlite'
     self.db = factory.createdb('sqlite:///' + testdb, __DB_FORMAT__)
     self.tester = SetupTester(__DB_FORMAT__, testdb)
     self.tester.create()
コード例 #18
0
ファイル: test_factory.py プロジェクト: gadeleon/pwman3
 def test_factory_check_db_file(self):
     fn = os.path.join(os.path.dirname(__file__), 'baz.db')
     db = factory.createdb('sqlite:///'+os.path.abspath(fn), 0.3)
     db._open()
     self.assertEqual(factory.check_db_version('sqlite:///'+fn), 0.3)
     os.unlink(fn)