Repository: mozmeao/basket

Issue:
FxA SFMC Feed Into Firefox_Account_ID
Hi - I'm wondering if the feed from Firefox accounts directly into Marketing Cloud (Firefox_Account_ID, specifically) is still turned on? If so, we'd like to have it turned off. Thanks!


Discussion:
It is on. I'll have a PR in shortly to turn it off.

Resolving patch:
diff --git a/basket/news/tasks.py b/basket/news/tasks.py
--- a/basket/news/tasks.py
+++ b/basket/news/tasks.py
@@ -312,7 +312,7 @@ def fxa_delete(data):
 
 @et_task
 def fxa_verified(data):
-    """Add new FxA users to an SFMC data extension and SFDC"""
+    """Add new FxA users to SFDC"""
     # if we're not using the sandbox ignore testing domains
     if email_is_testing(data["email"]):
         return
@@ -324,19 +324,18 @@ def fxa_verified(data):
     # avoid modifying the passed in dict
     new_data = deepcopy(data)
     new_data["lang"] = lang
-
-    # add the data to SFMC
-    # do this part async so that it can retry independent of the SFDC parts
-    fxa_verified_sfmc.delay(new_data)
-
-    # add the data to SFDC
-    # do this part async so that it can retry independent of the SFMC parts
-    if settings.FXA_EVENTS_VERIFIED_SFDC_ENABLE:
-        fxa_verified_sfdc.delay(new_data)
+    fxa_verified_sfdc_tmp(new_data)
 
 
 @et_task
 def fxa_verified_sfdc(data):
+    """Temporary task to process remaining tasks
+
+    TODO delete me after prod deployment"""
+    fxa_verified_sfdc_tmp(data)
+
+
+def fxa_verified_sfdc_tmp(data):
     email = data["email"]
     fxa_id = data["uid"]
     lang = data["lang"]
@@ -370,6 +369,11 @@ def fxa_verified_sfdc(data):
 
 @et_task
 def fxa_verified_sfmc(data):
+    """No longer needed but kept temporarily so we don't leave tasks on the queue
+
+    See https://github.com/mozmeao/basket/issues/572
+
+    TODO delete me after next deployment"""
     create_date = data.get("createDate")
     if create_date:
         create_date = datetime.fromtimestamp(create_date)


Test patch:
diff --git a/basket/news/tests/test_tasks.py b/basket/news/tests/test_tasks.py
--- a/basket/news/tests/test_tasks.py
+++ b/basket/news/tests/test_tasks.py
@@ -854,11 +854,10 @@ def test_firefox_ios_tablet(self):
 )
 @patch("basket.news.tasks.get_best_language", Mock(return_value="en-US"))
 @patch("basket.news.tasks.newsletter_languages", Mock(return_value=["en-US"]))
-@patch("basket.news.tasks.apply_updates")
 @patch("basket.news.tasks.upsert_contact")
 @patch("basket.news.tasks.get_fxa_user_data")
 class FxAVerifiedTests(TestCase):
-    def test_success(self, fxa_data_mock, upsert_mock, apply_mock):
+    def test_success(self, fxa_data_mock, upsert_mock):
         fxa_data_mock.return_value = {"lang": "en-US"}
         data = {
             "email": "thedude@example.com",
@@ -882,18 +881,8 @@ def test_success(self, fxa_data_mock, upsert_mock, apply_mock):
             },
             fxa_data_mock(),
         )
-        apply_mock.assert_called_with(
-            "Firefox_Account_ID",
-            {
-                "EMAIL_ADDRESS_": data["email"],
-                "CREATED_DATE_": ANY,
-                "FXA_ID": "the-fxa-id",
-                "FXA_LANGUAGE_ISO2": "en-US",
-                "SERVICE": "sync",
-            },
-        )
 
-    def test_with_newsletters(self, fxa_data_mock, upsert_mock, apply_mock):
+    def test_with_newsletters(self, fxa_data_mock, upsert_mock):
         fxa_data_mock.return_value = None
         data = {
             "email": "thedude@example.com",
@@ -923,18 +912,8 @@ def test_with_newsletters(self, fxa_data_mock, upsert_mock, apply_mock):
             },
             None,
         )
-        apply_mock.assert_called_with(
-            "Firefox_Account_ID",
-            {
-                "EMAIL_ADDRESS_": data["email"],
-                "CREATED_DATE_": ANY,
-                "FXA_ID": "the-fxa-id",
-                "FXA_LANGUAGE_ISO2": "en-US",
-                "SERVICE": "sync",
-            },
-        )
 
-    def test_with_subscribe_and_metrics(self, fxa_data_mock, upsert_mock, apply_mock):
+    def test_with_subscribe_and_metrics(self, fxa_data_mock, upsert_mock):
         fxa_data_mock.return_value = None
         data = {
             "email": "thedude@example.com",
@@ -962,18 +941,8 @@ def test_with_subscribe_and_metrics(self, fxa_data_mock, upsert_mock, apply_mock
             },
             None,
         )
-        apply_mock.assert_called_with(
-            "Firefox_Account_ID",
-            {
-                "EMAIL_ADDRESS_": data["email"],
-                "CREATED_DATE_": ANY,
-                "FXA_ID": "the-fxa-id",
-                "FXA_LANGUAGE_ISO2": "en-US",
-                "SERVICE": "monitor",
-            },
-        )
 
-    def test_with_createDate(self, fxa_data_mock, upsert_mock, apply_mock):
+    def test_with_createDate(self, fxa_data_mock, upsert_mock):
         fxa_data_mock.return_value = None
         create_date = 1526996035.498
         data = {
@@ -1000,16 +969,6 @@ def test_with_createDate(self, fxa_data_mock, upsert_mock, apply_mock):
             },
             None,
         )
-        apply_mock.assert_called_with(
-            "Firefox_Account_ID",
-            {
-                "EMAIL_ADDRESS_": data["email"],
-                "CREATED_DATE_": gmttime(datetime.fromtimestamp(create_date)),
-                "FXA_ID": "the-fxa-id",
-                "FXA_LANGUAGE_ISO2": "en-US",
-                "SERVICE": "",
-            },
-        )
 
 
 @patch("basket.news.tasks.upsert_user")