def setUp(self):
        self.json_meta_with_tags = open('sample_instance_metadata.json').read()

        self.patcher1 = patch(
            'azfilebak.azurevminstancemetadata.AzureVMInstanceMetadata.request_metadata',
            return_value=(json.JSONDecoder()).decode(self.json_meta_with_tags))
        self.patcher1.start()

        self.meta = AzureVMInstanceMetadata.create_instance()
예제 #2
0
    def setUp(self):
        self.json_meta = open('sample_instance_metadata.json').read()

        self.meta = AzureVMInstanceMetadata(
            lambda: (json.JSONDecoder()).decode(self.json_meta))

        self.patcher1 = patch(
            'azfilebak.azurevminstancemetadata.AzureVMInstanceMetadata.create_instance',
            return_value=self.meta)
        self.patcher1.start()

        self.cfg = BackupConfiguration(config_filename="sample_backup.conf")
예제 #3
0
 def __init__(self, config_filename):
     """
     >>> cfg = BackupConfiguration(config_filename="config.txt")
     >>> cfg.get_value("sap.CID")
     'ABC'
     >>> cfg.get_db_backup_interval_min()
     datetime.timedelta(1)
     >>> some_tuesday_evening = "20180605_215959"
     >>> cfg.get_business_hours().is_backup_allowed_time(some_tuesday_evening)
     True
     """
     self.cfg_file = BackupConfigurationFile(filename=config_filename)
     self.instance_metadata = AzureVMInstanceMetadata.create_instance()
     self._block_blob_service = None
    def setUp(self):
        self.json_meta = open('sample_instance_metadata.json').read()

        self.meta = AzureVMInstanceMetadata(
            lambda: (json.JSONDecoder()).decode(self.json_meta))

        self.patcher1 = patch(
            'azfilebak.azurevminstancemetadata.AzureVMInstanceMetadata.create_instance',
            return_value=self.meta)
        self.patcher1.start()

        # Mock `dmidecode` execution
        self.patcher2 = patch('subprocess.check_output',
                              return_value='UUID000')

        self.cfg = BackupConfiguration(config_filename="sample_backup.conf")