|
31 | 31 |
|
32 | 32 |
|
33 | 33 | class TestIssueRequiresAuth(helper.UnitRequiresAuthenticationHelper):
|
34 |
| - |
35 | 34 | """Test Issue methods that require Authentication."""
|
36 | 35 |
|
37 | 36 | described_class = github3.issues.Issue
|
@@ -83,7 +82,6 @@ def test_unlock(self):
|
83 | 82 |
|
84 | 83 |
|
85 | 84 | class TestIssue(helper.UnitHelper):
|
86 |
| - |
87 | 85 | """Test Issue methods that make simple requests."""
|
88 | 86 |
|
89 | 87 | described_class = github3.issues.Issue
|
@@ -120,7 +118,11 @@ def test_assign_empty_username(self):
|
120 | 118 | def test_close(self):
|
121 | 119 | """Verify the request for closing an issue."""
|
122 | 120 | self.instance.close()
|
123 |
| - labels = [str(label) for label in self.instance.original_labels] |
| 121 | + try: |
| 122 | + labels = [str(label) for label in self.instance.original_labels] |
| 123 | + except UnicodeEncodeError: |
| 124 | + labels = [label.name for label in self.instance.original_labels] |
| 125 | + |
124 | 126 | self.patch_called_with(
|
125 | 127 | url_for(),
|
126 | 128 | data={
|
@@ -169,6 +171,21 @@ def test_comment_positive_id(self):
|
169 | 171 | self.instance.comment(-1)
|
170 | 172 | assert self.session.get.called is False
|
171 | 173 |
|
| 174 | + def test_close_with_unicode_labels(self): |
| 175 | + """Verify the request for closeing an issue.""" |
| 176 | + data = { |
| 177 | + 'title': 'issue title', |
| 178 | + 'body': 'issue body', |
| 179 | + 'assignee': 'sigmavirus24', |
| 180 | + 'state': 'closed', |
| 181 | + 'labels': [u"标签1", u"标签2"] |
| 182 | + } |
| 183 | + self.instance.edit(**data) |
| 184 | + self.patch_called_with( |
| 185 | + url_for(), |
| 186 | + data=data |
| 187 | + ) |
| 188 | + |
172 | 189 | def test_edit(self):
|
173 | 190 | """Verify the request for editing an issue."""
|
174 | 191 | data = {
|
@@ -323,7 +340,6 @@ def test_replace_labels(self):
|
323 | 340 |
|
324 | 341 |
|
325 | 342 | class TestIssueIterators(helper.UnitIteratorHelper):
|
326 |
| - |
327 | 343 | """Test Issue methods that return iterators."""
|
328 | 344 |
|
329 | 345 | described_class = github3.issues.Issue
|
@@ -364,7 +380,6 @@ def test_labels(self):
|
364 | 380 |
|
365 | 381 |
|
366 | 382 | class TestLabelRequiresAuth(helper.UnitRequiresAuthenticationHelper):
|
367 |
| - |
368 | 383 | """Test that ensure certain methods on Label class requires auth."""
|
369 | 384 |
|
370 | 385 | described_class = github3.issues.label.Label
|
@@ -429,7 +444,6 @@ def test_update(self):
|
429 | 444 |
|
430 | 445 |
|
431 | 446 | class TestIssueEvent(helper.UnitHelper):
|
432 |
| - |
433 | 447 | """Unit test for IssueEvent."""
|
434 | 448 |
|
435 | 449 | described_class = github3.issues.event.IssueEvent
|
|
0 commit comments