def _get_user_settings(args, provider=None): user_settings = Settings() if 'config' in vars(args): user_settings.read_settings(filename=args.config) else: user_settings.read_settings() _merge_arguments(user_settings, provider, vars(args)) return user_settings
def test_hoster_purchase(self, hoster): user_settings = Settings() self._merge_random_user_data(user_settings) host = hoster(user_settings) options = list(host.get_options())[0] wallet = MagicMock() wallet.pay = MagicMock() try: host.purchase(wallet, options) wallet.pay.assert_called_once() except VPSOutOfStockException as exception: self.skipTest(exception)
def _get_user_settings(args, provider=None): user_settings = Settings() if 'config' in vars(args): user_settings.read_settings(filename=args.config) else: user_settings.read_settings() _merge_arguments(user_settings, provider, vars(args)) # Set global testnet variable according to configuration if user_settings.has_key('user', 'testnet') and user_settings.get( 'user', 'testnet') == '1': os.environ['TESTNET'] = '1' else: os.environ['TESTNET'] = '0' return user_settings
def test_generate_child_has_content(self, mock): fake_generator.generate_child_account() account = Settings() account.read_settings(test_file) self.assertIsNotNone(account.get('user', 'email')) self.assertIsNotNone(account.get('user', 'firstname')) self.assertIsNotNone(account.get('user', 'lastname')) self.assertIsNotNone(account.get('user', 'companyname')) self.assertIsNotNone(account.get('user', 'phonenumber')) self.assertIsNotNone(account.get('user', 'password')) self.assertIsNotNone(account.get('address', 'address')) self.assertIsNotNone(account.get('address', 'city')) self.assertIsNotNone(account.get('address', 'state')) self.assertIsNotNone(account.get('address', 'countrycode')) self.assertIsNotNone(account.get('address', 'zipcode')) self.assertIsNotNone(account.get('server', 'root_password')) self.assertEqual(account.get('server', 'ns1'), 'ns1') self.assertEqual(account.get('server', 'ns2'), 'ns2') self.assertIsNotNone(account.get('server', 'hostname'))
def setUp(self): self.settings = Settings() self.settings.put("user", "accountnumber", "2132sadfqf") self.wallet = MagicMock(Wallet) self.mullvad = MullVad(self.settings) self.option = MagicMock(VpnOption)
def setUp(self): self.settings = Settings() self.settings.read_settings( os.path.join(os.path.dirname(__file__), 'resources/test_settings.cfg'))
from plebnet.agent.config import PlebNetConfig from plebnet.agent.qtable import QTable from plebnet.utilities import fake_generator from cloudomate.util.settings import Settings from plebnet.settings import plebnet_settings as setup from mock.mock import MagicMock from plebnet.utilities import logger as Logger test_log_path = os.path.join(user_config_dir(), 'tests_logs') test_log_file = os.path.join(user_config_dir(), 'tests_logs/plebnet.logs') test_child_file = os.path.join(user_config_dir(), 'test_child_config.cfg') test_child_QTable_file = os.path.join(user_config_dir(), 'Child_QTable.json') test_bought = ['linevast', 'Advanced', 666, 0] plebnet_file = os.path.join(user_config_dir(), 'plebnet.json') test_account = Settings() class TestServerInstaller(unittest.TestCase): # test_account = None test_qtable = None @mock.patch('plebnet.utilities.fake_generator._child_file', return_value=test_child_file) def setUp(self, mock): if os.path.isfile(test_log_file): os.remove(test_log_file) if os.path.isfile(test_child_file): os.remove(test_child_file)
def __init__(self): self._browser = StatefulBrowser(user_agent="Firefox") self._settings = Settings() self._settings.read_settings()