# in this software or its documentation. # # # Tests verious codepaths for server registration # import sys import time import unittest from spacewalk.common import rhnFlags from spacewalk.common.rhnConfig import initCFG, CFG from spacewalk.server import rhnSQL, rhnServer, rhnChannel, rhnUser from spacewalk.server.handlers.xmlrpc import registration import misc_functions DB_SETTINGS = misc_functions.db_settings("oracle") class Tests(unittest.TestCase): _channel = 'redhat-advanced-server-i386' _channel_family = 'rhel-as' _entitlements = {'enterprise_entitled': None} def setUp(self): initCFG("server.xmlrpc") rhnSQL.initDB(backend="oracle", username=DB_SETTINGS["user"], password=DB_SETTINGS["password"], database=DB_SETTINGS["database"]) def tearDown(self):
# Red Hat trademarks are not licensed under GPLv2. No permission is # granted to use or replicate Red Hat trademarks that are incorporated # in this software or its documentation. # # # # import sys import unittest from spacewalk.common.rhnConfig import initCFG from spacewalk.server import rhnSQL, rhnUser import misc_functions DB_SETTINGS = misc_functions.db_settings("oracle") class Tests(unittest.TestCase): def setUp(self): initCFG("server") rhnSQL.initDB( backend="oracle", username=DB_SETTINGS["user"], password=DB_SETTINGS["password"], database=DB_SETTINGS["database"] ) def tearDown(self): # Roll back any unsaved data
#!/usr/bin/python # Copyright (c) 2005--2015 Red Hat, Inc. # # # import unittest from spacewalk.common.rhnConfig import CFG, initCFG from spacewalk.server import rhnSQL import misc_functions DB_SETTINGS = misc_functions.db_settings("postgresql") class ExceptionsTest(unittest.TestCase): def test_failed_connection(self): # Connect to localhost and look for db on a totally bogus port, this # makes the test faster. host = "localhost" username = "******" password = "******" database = "z" port = 9000 self.assertRaises(rhnSQL.SQLConnectError, rhnSQL.initDB, "postgresql", host, port, database, username, password) try: rhnSQL.initDB(backend="postgresql", username=DB_SETTINGS["user"],