Exemplo n.º 1
0
 def test_chk_database_5(self):
     with self.assertRaises(SystemExit):
         js = SnapAdmin()
         js.db['store_in_sqlite'] = True
         js.args.file = os.path.join(os.path.dirname(__file__), 'configs', 'main.yml')
         config_file = open(js.args.file, 'r')
         config_data = yaml.load(config_file, Loader=yaml.FullLoader)
         del (config_data['sqlite'][0]['store_in_sqlite'])
         del (config_data['sqlite'][0]['check_from_sqlite'])
         config_data['sqlite'][0]['compare'] = '0'
         js.chk_database(config_data, 'mock_pre', 'mock_post', check=True)
Exemplo n.º 2
0
 def test_chk_database_1(self):
     with self.assertRaises(SystemExit):
         js = SnapAdmin()
         js.db['store_in_sqlite'] = True
         js.args.file = os.path.join(os.path.dirname(__file__), 'configs', 'main.yml')
         config_file = open(js.args.file, 'r')
         config_data = yaml.load(config_file, Loader=yaml.FullLoader)
         del (config_data['sqlite'][0]['database_name'])  # either we could have a config file with no db name
         del (config_data['sqlite'][0]['store_in_sqlite'])
         del (config_data['sqlite'][0]['check_from_sqlite'])
         js.chk_database(config_data, 'mock_pre', 'mock_post')  # or we could delete the key value pair