def test_to_vendor_test_domain(self, nm_mock): """Same as main test but should flip UAT_Test_Data__c switch""" nm_mock.return_value = { "chillin": "Sub_Chillin__c", "bowlin": "Sub_Bowlin__c", "white-russian-recipes": "Sub_Caucasians__c", } data = { "email": "*****@*****.**", "token": "totally-token-man", "format": "H", "country": "US", "lang": "en", "source_url": "https://www.example.com", "first_name": "The", "last_name": "Dude", "newsletters": ["chillin", "bowlin", "white-russian-recipes"], } contact = { "Email_Format__c": "H", "FirstName": "The", "LastName": "Dude", "Subscriber__c": True, "Email_Language__c": "en", "Signup_Source_URL__c": "https://www.example.com", "Token__c": "totally-token-man", "Email": "*****@*****.**", "MailingCountryCode": "us", "Sub_Chillin__c": True, "Sub_Bowlin__c": True, "Sub_Caucasians__c": True, "UAT_Test_Data__c": True, } self.assertDictEqual(to_vendor(data), contact)
def test_to_vendor_extra_langs(self): data = { 'email': '*****@*****.**', 'token': 'totally-token-man', 'format': 'H', 'country': 'US', 'lang': 'zh-TW', 'source_url': 'https://www.example.com', 'first_name': 'The', 'last_name': 'Dude', 'fsa_allow_share': 'y', 'optout': 'no', 'optin': 'true', } contact = { 'Email_Format__c': 'H', 'FirstName': 'The', 'LastName': 'Dude', 'Subscriber__c': True, 'Email_Language__c': 'zh-TW', 'Signup_Source_URL__c': 'https://www.example.com', 'Token__c': 'totally-token-man', 'Email': '*****@*****.**', 'MailingCountryCode': 'us', 'FSA_Allow_Info_Shared__c': True, 'HasOptedOutOfEmail': False, 'Double_Opt_In__c': True, } self.assertDictEqual(to_vendor(data), contact)
def test_to_vendor_extra_langs(self): data = { "email": "*****@*****.**", "token": "totally-token-man", "format": "H", "country": "US", "lang": "zh-TW", "source_url": "https://www.example.com", "first_name": "The", "last_name": "Dude", "fsa_allow_share": "y", "optout": "no", "optin": "true", } contact = { "Email_Format__c": "H", "FirstName": "The", "LastName": "Dude", "Subscriber__c": True, "Email_Language__c": "zh-TW", "Signup_Source_URL__c": "https://www.example.com", "Token__c": "totally-token-man", "Email": "*****@*****.**", "MailingCountryCode": "us", "FSA_Allow_Info_Shared__c": True, "HasOptedOutOfEmail": False, "Double_Opt_In__c": True, } self.assertDictEqual(to_vendor(data), contact)
def test_to_vendor_test_domain(self, nm_mock): """Same as main test but should flip UAT_Test_Data__c switch""" nm_mock.return_value = { 'chillin': 'Sub_Chillin__c', 'bowlin': 'Sub_Bowlin__c', 'white-russian-recipes': 'Sub_Caucasians__c', } data = { 'email': '*****@*****.**', 'token': 'totally-token-man', 'format': 'H', 'country': 'US', 'lang': 'en', 'source_url': 'https://www.example.com', 'first_name': 'The', 'last_name': 'Dude', 'newsletters': [ 'chillin', 'bowlin', 'white-russian-recipes', ] } contact = { 'Email_Format__c': 'H', 'FirstName': 'The', 'LastName': 'Dude', 'Subscriber__c': True, 'Email_Language__c': 'en', 'Signup_Source_URL__c': 'https://www.example.com', 'Token__c': 'totally-token-man', 'Email': '*****@*****.**', 'MailingCountryCode': 'us', 'Sub_Chillin__c': True, 'Sub_Bowlin__c': True, 'Sub_Caucasians__c': True, 'UAT_Test_Data__c': True, } self.assertDictEqual(to_vendor(data), contact)
def test_to_vendor_dict_newsletters(self, nm_mock): nm_mock.return_value = { "chillin": "Sub_Chillin__c", "bowlin": "Sub_Bowlin__c", "fightin": "Sub_Fightin__c", } data = { "email": "*****@*****.**", "token": "totally-token-man", "format": "T", "country": "mx", "lang": "es", "source_url": "https://www.example.com", "first_name": "Senior", "last_name": "Lebowski", "newsletters": { "chillin": True, "bowlin": True, "fightin": False }, } contact = { "Email_Format__c": "T", "FirstName": "Senior", "LastName": "Lebowski", "Subscriber__c": True, "Email_Language__c": "es", "Signup_Source_URL__c": "https://www.example.com", "Token__c": "totally-token-man", "Email": "*****@*****.**", "MailingCountryCode": "mx", "Sub_Chillin__c": True, "Sub_Bowlin__c": True, "Sub_Fightin__c": False, } self.assertDictEqual(to_vendor(data), contact)
def test_to_vendor_dict_newsletters(self, nm_mock): nm_mock.return_value = { 'chillin': 'Sub_Chillin__c', 'bowlin': 'Sub_Bowlin__c', 'fightin': 'Sub_Fightin__c', } data = { 'email': '*****@*****.**', 'token': 'totally-token-man', 'format': 'T', 'country': 'mx', 'lang': 'es', 'source_url': 'https://www.example.com', 'first_name': 'Senior', 'last_name': 'Lebowski', 'newsletters': { 'chillin': True, 'bowlin': True, 'fightin': False, } } contact = { 'Email_Format__c': 'T', 'FirstName': 'Senior', 'LastName': 'Lebowski', 'Subscriber__c': True, 'Email_Language__c': 'es', 'Signup_Source_URL__c': 'https://www.example.com', 'Token__c': 'totally-token-man', 'Email': '*****@*****.**', 'MailingCountryCode': 'mx', 'Sub_Chillin__c': True, 'Sub_Bowlin__c': True, 'Sub_Fightin__c': False, } self.assertDictEqual(to_vendor(data), contact)