Exemplo n.º 1
0
class ApplianceTimeAndLocaleConfigurationTest(unittest.TestCase):
    def setUp(self):
        self.host = '127.0.0.1'
        self.connection = connection(self.host)
        self._time_and_locale = ApplianceTimeAndLocaleConfiguration(
            self.connection)

    @mock.patch.object(ResourceClient, 'get')
    def test_get_called_once(self, mock_get):
        self._time_and_locale.get()
        mock_get.assert_called_once_with(
            '/rest/appliance/configuration/time-locale')

    @mock.patch.object(ResourceClient, 'create')
    def test_update_called_once(self, mock_create):
        resource = {
            'dateTime': '2020-02-27T7:55:00.000Z',
            'locale': 'en_US.UTF-8',
            'localeDisplayName': 'English (United States)',
            'ntpServers': ['127.0.0.1'],
            'timezone': 'UTC',
            'uri': None
        }
        self._time_and_locale.update(resource)
        mock_create.assert_called_once_with(
            resource,
            timeout=-1,
            default_values=self._time_and_locale.DEFAULT_VALUES)
Exemplo n.º 2
0
    def appliance_time_and_locale_configuration(self):
        """
        Gets the ApplianceTimeAndLocaleConfiguration API client.

        Returns:
            ApplianceTimeAndLocaleConfiguration:
        """
        if not self.__appliance_time_and_locale_configuration:
            self.__appliance_time_and_locale_configuration = ApplianceTimeAndLocaleConfiguration(self.__connection)
        return self.__appliance_time_and_locale_configuration
class ApplianceTimeAndLocaleConfigurationTest(unittest.TestCase):
    def setUp(self):
        self.host = '127.0.0.1'
        self.connection = connection(self.host)
        self._time_and_locale = ApplianceTimeAndLocaleConfiguration(self.connection)

    @mock.patch.object(ResourceClient, 'get')
    def test_get_called_once(self, mock_get):
        self._time_and_locale.get()
        mock_get.assert_called_once_with('/rest/appliance/configuration/time-locale')

    @mock.patch.object(ResourceClient, 'create')
    def test_update_called_once(self, mock_create):
        resource = {
            'dateTime': '2020-02-27T7:55:00.000Z',
            'locale': 'en_US.UTF-8',
            'localeDisplayName': 'English (United States)',
            'ntpServers': ['127.0.0.1'],
            'timezone': 'UTC',
            'uri': None
        }
        self._time_and_locale.update(resource)
        mock_create.assert_called_once_with(resource, timeout=-1, default_values=self._time_and_locale.DEFAULT_VALUES)
 def setUp(self):
     self.host = '127.0.0.1'
     self.connection = connection(self.host)
     self._time_and_locale = ApplianceTimeAndLocaleConfiguration(self.connection)
 def setUp(self):
     self.host = '127.0.0.1'
     self.connection = connection(self.host)
     self._time_and_locale = ApplianceTimeAndLocaleConfiguration(self.connection)