@@ -73,6 +73,7 @@ def test_update_txconfig_resources_with_config(home_in_temp, temp):
73
73
74
74
data = (tx_dir / 'config' ).text ()
75
75
assert re .search (r'\[o:eggs-org:p:ham-project:r:README\]' , data )
76
+ assert re .search (r'\nresource_name = README\n' , data )
76
77
77
78
78
79
def 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):
95
96
96
97
data = (tx_dir / 'config' ).text ().replace ('\\ ' , '/' )
97
98
assert re .search (r'\[o:eggs-org:p:ham-project:r:README\]' , data )
99
+ assert re .search (r'\nresource_name = README\n' , data )
98
100
assert re .search (r'source_file\W*=\W*_build/locale/README.pot' , data )
99
101
100
102
@@ -118,6 +120,7 @@ def test_update_txconfig_resources_with_project_name_including_dots(home_in_temp
118
120
119
121
data = (tx_dir / 'config' ).text ()
120
122
assert re .search (r'\[o:eggs-org:p:ham-projectcom:r:README\]' , data )
123
+ assert re .search (r'\nresource_name = README\n' , data )
121
124
122
125
123
126
def 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
140
143
141
144
data = (tx_dir / 'config' ).text ()
142
145
assert re .search (r'\[o:eggs-org:p:ham-project-com:r:README\]' , data )
146
+ assert re .search (r'\nresource_name = README\n' , data )
143
147
144
148
145
149
def 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,
170
174
data = (tx_dir / 'config' ).text ()
171
175
assert re .search (r'\[o:eggs-org:p:ham-project-com:r:example_document\]' , data )
172
176
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
+ [main]
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