Show More
@@ -126,8 +126,8 b' def test_get_nodes_returns_unicode_flat(' | |||
|
126 | 126 | repo = backend.repo |
|
127 | 127 | commit_id = repo.get_commit(commit_idx=0).raw_id |
|
128 | 128 | directories, files = scm.ScmModel().get_nodes(repo.repo_name, commit_id, flat=True) |
|
129 |
assert_contains_only_ |
|
|
130 |
assert_contains_only_ |
|
|
129 | assert_contains_only_str_chars(directories) | |
|
130 | assert_contains_only_str_chars(files) | |
|
131 | 131 | |
|
132 | 132 | |
|
133 | 133 | def test_get_nodes_returns_unicode_non_flat(backend): |
@@ -137,8 +137,8 b' def test_get_nodes_returns_unicode_non_f' | |||
|
137 | 137 | directories, files = scm.ScmModel().get_nodes(repo.repo_name, commit_id, flat=False) |
|
138 | 138 | # johbo: Checking only the names for now, since that is the critical |
|
139 | 139 | # part. |
|
140 |
assert_contains_only_ |
|
|
141 |
assert_contains_only_ |
|
|
140 | assert_contains_only_str_chars([d['name'] for d in directories]) | |
|
141 | assert_contains_only_str_chars([f['name'] for f in files]) | |
|
142 | 142 | |
|
143 | 143 | |
|
144 | 144 | def test_get_nodes_max_file_bytes(backend_random): |
@@ -158,31 +158,32 b' def test_get_nodes_max_file_bytes(backen' | |||
|
158 | 158 | for file in files) |
|
159 | 159 | |
|
160 | 160 | |
|
161 |
def assert_contains_only_ |
|
|
161 | def assert_contains_only_str_chars(structure): | |
|
162 | 162 | assert structure |
|
163 | 163 | for value in structure: |
|
164 | 164 | assert isinstance(value, str) |
|
165 | 165 | |
|
166 | 166 | |
|
167 | 167 | @pytest.mark.backends("hg", "git") |
|
168 |
def test_get_non_ |
|
|
168 | def test_get_non_str_reference(backend): | |
|
169 | 169 | model = scm.ScmModel() |
|
170 | non_unicode_list = ["Adını".encode("cp1254")] | |
|
170 | special_name = "Adını" | |
|
171 | non_str_list = [special_name] | |
|
171 | 172 | |
|
172 | 173 | def scm_instance(): |
|
173 | 174 | return Mock( |
|
174 |
branches=non_ |
|
|
175 |
tags=non_ |
|
|
175 | branches=non_str_list, bookmarks=non_str_list, | |
|
176 | tags=non_str_list, alias=backend.alias) | |
|
176 | 177 | |
|
177 | 178 | repo = Mock(__class__=db.Repository, scm_instance=scm_instance) |
|
178 | 179 | choices, __ = model.get_repo_landing_revs(translator=lambda s: s, repo=repo) |
|
179 | 180 | if backend.alias == 'hg': |
|
180 | 181 | valid_choices = [ |
|
181 |
'rev:tip', 'branch: |
|
|
182 | 'book:Ad\xc4\xb1n\xc4\xb1', 'tag:Ad\xc4\xb1n\xc4\xb1'] | |
|
182 | 'rev:tip', f'branch:{special_name}', | |
|
183 | f'book:{special_name}', f'tag:{special_name}'] | |
|
183 | 184 | else: |
|
184 | 185 | valid_choices = [ |
|
185 |
'rev:tip', 'branch: |
|
|
186 | 'tag:Ad\xc4\xb1n\xc4\xb1'] | |
|
186 | 'rev:tip', f'branch:{special_name}', | |
|
187 | f'tag:{special_name}'] | |
|
187 | 188 | |
|
188 | 189 | assert choices == valid_choices |
General Comments 0
You need to be logged in to leave comments.
Login now