def test_set_delete_retention_policy_edge_cases(
            self, datalake_storage_account_name, datalake_storage_account_key):
        self._setUp(datalake_storage_account_name,
                    datalake_storage_account_key)
        delete_retention_policy = RetentionPolicy(enabled=True, days=1)
        self.dsc.set_service_properties(
            delete_retention_policy=delete_retention_policy)

        # Assert
        received_props = self.dsc.get_service_properties()
        self._assert_delete_retention_policy_equal(
            received_props['delete_retention_policy'], delete_retention_policy)

        # Should work with maximum settings
        delete_retention_policy = RetentionPolicy(enabled=True, days=365)
        self.dsc.set_service_properties(
            delete_retention_policy=delete_retention_policy)

        # Assert
        received_props = self.dsc.get_service_properties()
        self._assert_delete_retention_policy_equal(
            received_props['delete_retention_policy'], delete_retention_policy)

        # Should not work with 0 days
        delete_retention_policy = RetentionPolicy(enabled=True, days=0)

        with self.assertRaises(HttpResponseError):
            self.dsc.set_service_properties(
                delete_retention_policy=delete_retention_policy)

        # Assert
        received_props = self.dsc.get_service_properties()
        self._assert_delete_retention_policy_not_equal(
            received_props['delete_retention_policy'], delete_retention_policy)

        # Should not work with 366 days
        delete_retention_policy = RetentionPolicy(enabled=True, days=366)

        with self.assertRaises(HttpResponseError):
            self.dsc.set_service_properties(
                delete_retention_policy=delete_retention_policy)

        # Assert
        received_props = self.dsc.get_service_properties()
        self._assert_delete_retention_policy_not_equal(
            received_props['delete_retention_policy'], delete_retention_policy)
    async def test_set_delete_retention_policy(self, datalake_storage_account_name, datalake_storage_account_key):
        self._setUp(datalake_storage_account_name, datalake_storage_account_key)
        delete_retention_policy = RetentionPolicy(enabled=True, days=2)

        # Act
        await self.dsc.set_service_properties(delete_retention_policy=delete_retention_policy)

        # Assert
        received_props = await self.dsc.get_service_properties()
        self._assert_delete_retention_policy_equal(received_props['delete_retention_policy'], delete_retention_policy)
    async def test_set_minute_metrics(self, datalake_storage_account_name, datalake_storage_account_key):
        self._setUp(datalake_storage_account_name, datalake_storage_account_key)
        minute_metrics = Metrics(
            enabled=True, include_apis=True, retention_policy=RetentionPolicy(enabled=True, days=5))

        # Act
        await self.dsc.set_service_properties(minute_metrics=minute_metrics)

        # Assert
        received_props = await self.dsc.get_service_properties()
        self._assert_metrics_equal(received_props['minute_metrics'], minute_metrics)
    def test_set_hour_metrics(self, datalake_storage_account_name,
                              datalake_storage_account_key):
        self._setUp(datalake_storage_account_name,
                    datalake_storage_account_key)
        hour_metrics = Metrics(include_apis=False,
                               enabled=True,
                               retention_policy=RetentionPolicy(enabled=True,
                                                                days=5))

        # Act
        self.dsc.set_service_properties(hour_metrics=hour_metrics)

        # Assert
        received_props = self.dsc.get_service_properties()
        self._assert_metrics_equal(received_props['hour_metrics'],
                                   hour_metrics)
    def test_set_logging(self, datalake_storage_account_name,
                         datalake_storage_account_key):
        self._setUp(datalake_storage_account_name,
                    datalake_storage_account_key)
        logging = AnalyticsLogging(read=True,
                                   write=True,
                                   delete=True,
                                   retention_policy=RetentionPolicy(
                                       enabled=True, days=5))

        # Act
        self.dsc.set_service_properties(analytics_logging=logging)

        # Assert
        received_props = self.dsc.get_service_properties()
        self._assert_logging_equal(received_props['analytics_logging'],
                                   logging)