Exemple #1
0
    def test_update_existing_email_destination(self):
        destination = DestinationConfigFactory(
            user=self.user,
            media_id="email",
            settings={
                "email_address": "*****@*****.**",
                "synced": False
            },
        )

        request = self.request_factory.post("/")
        request.user = self.user
        validated_data = {
            "media_id": "email",
            "settings": {
                "email_address": "*****@*****.**",
                "synced": False,
            },
            "user": self.user,
        }
        serializer = RequestDestinationConfigSerializer(
            context={"request": request}, )
        obj = serializer.update(destination, validated_data)
        self.assertEqual(obj.settings["email_address"],
                         "*****@*****.**")
Exemple #2
0
    def test_update_existing_sms_destination(self):
        if not "sms" in MEDIA_CLASSES_DICT.keys():
            self.skipTest("No sms plugin available")
        destination = DestinationConfigFactory(
            user=self.user,
            media_id="sms",
            settings={"phone_number": "+4747474747"},
        )

        request = self.request_factory.post("/")
        request.user = self.user
        validated_data = {
            "media_id": "sms",
            "settings": {
                "phone_number": "+4747474747",
            },
            "user": self.user,
        }
        serializer = RequestDestinationConfigSerializer(
            context={"request": request}, )
        obj = serializer.update(destination, validated_data)
        self.assertEqual(obj.settings["phone_number"], "+4747474747")