@@ -73,6 +73,7 @@ def test_update_txconfig_resources_with_config(home_in_temp, temp):
7373
7474    data  =  (tx_dir  /  'config' ).text ()
7575    assert  re .search (r'\[o:eggs-org:p:ham-project:r:README\]' , data )
76+     assert  re .search (r'\nresource_name = README\n' , data )
7677
7778
7879def  test_update_txconfig_resources_with_pot_dir_argument (home_in_temp , temp ):
@@ -95,6 +96,7 @@ def test_update_txconfig_resources_with_pot_dir_argument(home_in_temp, temp):
9596
9697    data  =  (tx_dir  /  'config' ).text ().replace ('\\ ' , '/' )
9798    assert  re .search (r'\[o:eggs-org:p:ham-project:r:README\]' , data )
99+     assert  re .search (r'\nresource_name = README\n' , data )
98100    assert  re .search (r'source_file\W*=\W*_build/locale/README.pot' , data )
99101
100102
@@ -118,6 +120,7 @@ def test_update_txconfig_resources_with_project_name_including_dots(home_in_temp
118120
119121    data  =  (tx_dir  /  'config' ).text ()
120122    assert  re .search (r'\[o:eggs-org:p:ham-projectcom:r:README\]' , data )
123+     assert  re .search (r'\nresource_name = README\n' , data )
121124
122125
123126def  test_update_txconfig_resources_with_project_name_including_spaces (home_in_temp , temp ):
@@ -140,6 +143,7 @@ def test_update_txconfig_resources_with_project_name_including_spaces(home_in_te
140143
141144    data  =  (tx_dir  /  'config' ).text ()
142145    assert  re .search (r'\[o:eggs-org:p:ham-project-com:r:README\]' , data )
146+     assert  re .search (r'\nresource_name = README\n' , data )
143147
144148
145149def  test_update_txconfig_resources_with_potfile_including_symbols (home_in_temp , temp ):
@@ -170,3 +174,33 @@ def test_update_txconfig_resources_with_potfile_including_symbols(home_in_temp,
170174    data  =  (tx_dir  /  'config' ).text ()
171175    assert  re .search (r'\[o:eggs-org:p:ham-project-com:r:example_document\]' , data )
172176    assert  re .search (r'\[o:eggs-org:p:ham-project-com:r:test_document\]' , data )
177+     assert  re .search (r'\nresource_name = example_document\n' , data )
178+     assert  re .search (r'\nresource_name = test_document\n' , data )
179+ 
180+ 
181+ def  test_update_txconfig_resources_with_potfile_including_path_separators (home_in_temp , temp ):
182+     tx_dir  =  temp  /  '.tx' 
183+     tx_dir .makedirs ()
184+     (tx_dir  /  'config' ).write_text (dedent ("""\  
185+ 
186+     host = https://www.transifex.com 
187+     """ ))
188+ 
189+     (temp  /  '_build'  /  'locale' ).copytree (temp  /  'locale'  /  'pot' )
190+ 
191+     # copy README.pot to 'example document.pot' 
192+     readme  =  (temp  /  '_build'  /  'locale'  /  'README.pot' ).text ()
193+     (temp  /  '_build'  /  'locale'  /  'example' ).makedirs ()
194+     (temp  /  '_build'  /  'locale'  /  'example'  /  'document.pot' ).write_text (readme )
195+ 
196+     r1  =  runner .invoke (commands .main ,
197+                        ['update-txconfig-resources' ,
198+                         '-d' , 'locale' ,
199+                         '--transifex-organization-name' , 'eggs-org' ,
200+                         '--transifex-project-name' , 'ham project com' ,
201+                         ])
202+     assert  r1 .exit_code  ==  0 
203+ 
204+     data  =  (tx_dir  /  'config' ).text ()
205+     assert  re .search (r'\[o:eggs-org:p:ham-project-com:r:example--document\]' , data )
206+     assert  re .search (r'\nresource_name = example--document\n' , data )
0 commit comments