Example #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))
    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)
Example #4
0
    def test_should_parse_dummy(self):
        # arrange - act
        parsed = ImplementationType.parse(ImplementationType.DUMMY.value)

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

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

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