Ejemplo n.º 1
0
 def on_change_configuration(self, **kwargs):
     """Handle a get configuration request."""
     if self.accept is True:
         return call_result.ChangeConfigurationPayload(
             ConfigurationStatus.accepted)
     else:
         return call_result.ChangeConfigurationPayload(
             ConfigurationStatus.rejected)
Ejemplo n.º 2
0
 def test_set_light_intensity_with_rejected_answer(self):
     """
     Test that an exception is raised if server reports reject on a set light intensity
     """
     comm = Mock()
     comm.blocking_call.return_value = call_result.ChangeConfigurationPayload(
         status='Rejected')
     socket = MockSocket()
     cpp = ChargePointProxy("CP1", socket, comm)
     with self.assertRaises(err.ChangeConfigurationException) as e:
         cpp.light_intensity = 90
Ejemplo n.º 3
0
 def test_set_light_intensity_with_accepted_answer(self):
     """
     Test that it is possible to set light intensity
     
     Acceptable values are 0 - 100 
     """
     comm = Mock()
     comm.blocking_call.return_value = call_result.ChangeConfigurationPayload(
         status='Accepted')
     socket = MockSocket()
     cpp = ChargePointProxy("CP1", socket, comm)
     for i in range(0, 110, 10):
         cpp.light_intensity = i
         comm.blocking_call.assert_called_with(
             call.ChangeConfigurationPayload(key='LightIntensity',
                                             value=str(i)))
Ejemplo n.º 4
0
 def change_configuration_notification(self, **kwargs):
     print("change configuration receive is", kwargs)
     return call_result.ChangeConfigurationPayload(
         status=ConfigurationStatus.
         accepted,  # Required. Returns whether configuration change has been accepted.
     )
Ejemplo n.º 5
0
 def on_change_configuration(self, key, value):
     return call_result.ChangeConfigurationPayload(
         status=RegistrationStatus.accepted)