@@ -36,7 +36,11 @@ def execute(self, current_user, input=None):
3636 def test_update_user_when_agreement_is_false (self ):
3737 self .execute (
3838 current_user = self .current_user ,
39- input = {"terms_agreement" : False , "customer_intent" : "Business" },
39+ input = {
40+ "business_email" :
"[email protected] " ,
41+ "name" : "codecov-user" ,
42+ "terms_agreement" : False ,
43+ },
4044 )
4145 before_refresh_business_email = self .current_user .email
4246
@@ -50,7 +54,11 @@ def test_update_user_when_agreement_is_false(self):
5054 def test_update_user_when_agreement_is_true (self ):
5155 self .execute (
5256 current_user = self .current_user ,
53- input = {"terms_agreement" : True , "customer_intent" : "Business" },
57+ input = {
58+ "business_email" :
"[email protected] " ,
59+ "name" : "codecov-user" ,
60+ "terms_agreement" : True ,
61+ },
5462 )
5563 before_refresh_business_email = self .current_user .email
5664
@@ -61,13 +69,13 @@ def test_update_user_when_agreement_is_true(self):
6169 assert self .current_user .email == before_refresh_business_email
6270
6371 @freeze_time ("2022-01-01T00:00:00" )
64- def test_update_owner_and_user_when_email_is_not_empty (self ):
72+ def test_update_owner_and_user_when_email_and_name_are_not_empty (self ):
6573 self .execute (
6674 current_user = self .current_user ,
6775 input = {
6876 "business_email" :
"[email protected] " ,
77+ "name" : "codecov-user" ,
6978 "terms_agreement" : True ,
70- "customer_intent" : "Business" ,
7179 },
7280 )
7381
@@ -76,12 +84,23 @@ def test_update_owner_and_user_when_email_is_not_empty(self):
7684
7785 self .current_user .refresh_from_db ()
7886 assert self .
current_user .
email == "[email protected] " 87+ assert self .current_user .name == "codecov-user"
7988
80- def test_validation_error_when_customer_intent_invalid (self ):
89+ def test_validation_error_when_email_invalid (self ):
8190 with pytest .raises (ValidationError ):
8291 self .execute (
8392 current_user = self .current_user ,
84- input = {"terms_agreement" : None , "customer_intent" : "invalid" },
93+ input = {"name" : "codecov-user" , "terms_agreement" : True },
94+ )
95+
96+ def test_validation_error_when_name_invalid (self ):
97+ with pytest .raises (ValidationError ):
98+ self .execute (
99+ current_user = self .current_user ,
100+ input = {
101+ "business_email" :
"[email protected] " ,
102+ "terms_agreement" : True ,
103+ },
85104 )
86105
87106 def test_user_is_not_authenticated (self ):
@@ -90,18 +109,19 @@ def test_user_is_not_authenticated(self):
90109 current_user = AnonymousUser (),
91110 input = {
92111 "business_email" :
"[email protected] " ,
112+ "name" : "codecov-user" ,
93113 "terms_agreement" : True ,
94- "customer_intent" : "Business" ,
95114 },
96115 )
97116
98117 def test_email_opt_in_saved_in_db (self ):
99118 self .execute (
100119 current_user = self .current_user ,
101120 input = {
121+ "business_email" :
"[email protected] " ,
122+ "name" : "codecov-user" ,
102123 "terms_agreement" : True ,
103124 "marketing_consent" : True ,
104- "customer_intent" : "Business" ,
105125 },
106126 )
107127 self .current_user .refresh_from_db ()
@@ -114,9 +134,10 @@ def test_marketo_called_only_with_consent(self, mock_send_data_to_marketo):
114134 self .execute (
115135 current_user = self .current_user ,
116136 input = {
137+ "business_email" :
"[email protected] " ,
138+ "name" : "codecov-user" ,
117139 "terms_agreement" : True ,
118140 "marketing_consent" : True ,
119- "customer_intent" : "Business" ,
120141 },
121142 )
122143
@@ -129,9 +150,10 @@ def test_marketo_not_called_without_consent(self, mock_send_data_to_marketo):
129150 self .execute (
130151 current_user = self .current_user ,
131152 input = {
153+ "business_email" :
"[email protected] " ,
154+ "name" : "codecov-user" ,
132155 "terms_agreement" : True ,
133156 "marketing_consent" : False ,
134- "customer_intent" : "Business" ,
135157 },
136158 )
137159
0 commit comments