@@ -201,6 +201,58 @@ async def test_extra_attributes(cli, db_conn, company):
201201 assert obj ['extra_attributes' ][2 ]['value' ] == '2032-06-01'
202202
203203
204+ async def test_tag_line_from_short_text (cli , db_conn , company ):
205+ eas = [
206+ {
207+ 'machine_name' : 'whatever' ,
208+ 'type' : 'text_short' ,
209+ 'name' : 'Should be tag line?' ,
210+ 'value' : 'Should be tag line.' ,
211+ 'sort_index' : 0
212+ },
213+ ]
214+ r = await signed_request (
215+ cli ,
216+ f'/{ company .public_key } /webhook/contractor' ,
217+ id = 123 ,
218+ deleted = False ,
219+ first_name = 'Fred' ,
220+ extra_attributes = eas
221+ )
222+ assert r .status == 201 , await r .text ()
223+ curr = await db_conn .execute (sa_contractors .select ())
224+ result = await curr .first ()
225+ assert result .id == 123
226+ assert result .first_name == 'Fred'
227+ assert result .tag_line == 'Should be tag line.'
228+
229+
230+ async def test_shorten_tag_line (cli , db_conn , company ):
231+ eas = [
232+ {
233+ 'machine_name' : 'whatever' ,
234+ 'type' : 'text_short' ,
235+ 'name' : 'Should be tag line?' ,
236+ 'value' : 'Should be tag line.' * 50 ,
237+ 'sort_index' : 0
238+ },
239+ ]
240+ r = await signed_request (
241+ cli ,
242+ f'/{ company .public_key } /webhook/contractor' ,
243+ id = 123 ,
244+ deleted = False ,
245+ first_name = 'Fred' ,
246+ extra_attributes = eas
247+ )
248+ assert r .status == 201 , await r .text ()
249+ curr = await db_conn .execute (sa_contractors .select ())
250+ result = await curr .first ()
251+ assert result .id == 123
252+ assert result .first_name == 'Fred'
253+ assert len (result .tag_line ) == 255
254+
255+
204256async def test_extra_attributes_special (cli , db_conn , company ):
205257 eas = [
206258 {
0 commit comments