예제 #1
0
    def _parse_data(self, data: Dict[Any, Any]):
        super()._parse_data(data)

        self.impl_type = ImplementationType.parse(super().get_setting_from_key(
            setting_key=f"{MotionHandlerSettings._KEY}.{MotionHandlerSettings._IMPL}",
            settings=data,
            default=ImplementationType.RASPI))
    def _parse_data(self, data: Dict[str, Any]):
        super()._parse_data(data)

        self.impl_type = ImplementationType.parse(super().get_setting_from_key(
            setting_key=f"{NetworkDeviceDetectorSettings._KEY}.{NetworkDeviceDetectorSettings.__IMPL_TYPE}",
            settings=data, 
            default=ImplementationType.DEFAULT.value))
예제 #3
0
    def _parse_data(self, data: Dict[str, Any]):
        super()._parse_data(data)

        self.impl_type = ImplementationType.parse(super().get_setting_from_key(
            setting_key=
            f"{MailClientSettings._KEY}.{MailClientSettings._IMPL_TYPE}",
            settings=data,
            default=ImplementationType.DEFAULT.value))

        self.user = super().get_setting_from_key(
            setting_key=f"{MailClientSettings._KEY}.{MailClientSettings._USER}",
            settings=data)

        self.password = super().get_setting_from_key(
            setting_key=
            f"{MailClientSettings._KEY}.{MailClientSettings._PASSWORD}",
            settings=data)

        self.receiver_mail = super().get_setting_from_key(
            setting_key=
            f"{MailClientSettings._KEY}.{MailClientSettings._RECEIVER_MAIL}",
            settings=data)

        self.sender_mail = super().get_setting_from_key(
            setting_key=
            f"{MailClientSettings._KEY}.{MailClientSettings._SENDER_MAIL}",
            settings=data)

        self.hostname = super().get_setting_from_key(
            setting_key=
            f"{MailClientSettings._KEY}.{MailClientSettings._HOSTNAME}",
            settings=data)
예제 #4
0
    def test_should_parse_dummy(self):
        # arrange - act
        parsed = ImplementationType.parse(ImplementationType.DUMMY.value)

        # assert
        self.assertEqual(ImplementationType.DUMMY, parsed)
예제 #5
0
 def test_should_raise_configuration_error(self):
     # act / assert
     with self.assertRaises(ConfigurationError):
         ImplementationType.parse('unknown_type')
예제 #6
0
    def test_should_parse_default(self):
        # arrange- act
        parsed = ImplementationType.parse(ImplementationType.DEFAULT.value)

        # assert
        self.assertEqual(ImplementationType.DEFAULT, parsed)
예제 #7
0
    def test_should_parse_raspi(self):
        # arrange- act
        parsed = ImplementationType.parse(ImplementationType.RASPI.value)

        # assert
        self.assertEqual(ImplementationType.RASPI, parsed)