Beispiel #1
0
    def test_docopt_for_account_type(self):
        result = Defaults.docopt_for_account_type('Standard_LRS')
        assert result == '--locally-redundant'

        result = Defaults.docopt_for_account_type('Standard_ZRS')
        assert result == '--zone-redundant'

        result = Defaults.docopt_for_account_type('Standard_GRS')
        assert result == '--geo-redundant'

        result = Defaults.docopt_for_account_type('Standard_RAGRS')
        assert result == '--read-access-geo-redundant'
Beispiel #2
0
 def __decorate(self, result):
     decorated = {
         'name': result.service_name,
         'description': result.storage_service_properties.description,
         'label': result.storage_service_properties.label,
         'backup-strategy': Defaults.docopt_for_account_type(
             result.storage_service_properties.account_type
         ),
         'region': result.storage_service_properties.geo_primary_region,
         'status': result.storage_service_properties.status,
         'backup': {
             'status': result.storage_service_properties.status_of_primary,
         },
         'endpoints': result.storage_service_properties.endpoints
     }
     if decorated['backup-strategy'] != '--locally-redundant':
         decorated['backup'].update({
             'backup-region': result.storage_service_properties.geo_secondary_region,
             'backup-region-status': result.storage_service_properties.status_of_secondary,
             'last-failover': result.storage_service_properties.last_geo_failover_time
         })
     if hasattr(result, 'containers') and result.containers:
         decorated['containers'] = result.containers
     if result.storage_service_keys:
         decorated['keys'] = {
             'primary': result.storage_service_keys.primary,
             'secondary': result.storage_service_keys.secondary
         }
     return decorated