|
| 1 | +# -*- coding: utf-8 -*- |
1 | 2 | """Unit tests for the Issue class.""" |
2 | 3 | importgithub3 |
3 | 4 | importmock |
|
31 | 32 |
|
32 | 33 |
|
33 | 34 | classTestIssueRequiresAuth(helper.UnitRequiresAuthenticationHelper): |
34 | | - |
35 | 35 | """Test Issue methods that require Authentication.""" |
36 | 36 |
|
37 | 37 | described_class=github3.issues.Issue |
@@ -83,7 +83,6 @@ def test_unlock(self): |
83 | 83 |
|
84 | 84 |
|
85 | 85 | classTestIssue(helper.UnitHelper): |
86 | | - |
87 | 86 | """Test Issue methods that make simple requests.""" |
88 | 87 |
|
89 | 88 | described_class=github3.issues.Issue |
@@ -120,7 +119,8 @@ def test_assign_empty_username(self): |
120 | 119 | deftest_close(self): |
121 | 120 | """Verify the request for closing an issue.""" |
122 | 121 | self.instance.close() |
123 | | -labels= [str(label)forlabelinself.instance.original_labels] |
| 122 | +labels= [label.nameforlabelinself.instance.original_labels] |
| 123 | + |
124 | 124 | self.patch_called_with( |
125 | 125 | url_for(), |
126 | 126 | data={ |
@@ -169,6 +169,21 @@ def test_comment_positive_id(self): |
169 | 169 | self.instance.comment(-1) |
170 | 170 | assertself.session.get.calledisFalse |
171 | 171 |
|
| 172 | +deftest_close_with_unicode_labels(self): |
| 173 | +"""Verify the request for closing an issue.""" |
| 174 | +data= { |
| 175 | +'title':'issue title', |
| 176 | +'body':'issue body', |
| 177 | +'assignee':'sigmavirus24', |
| 178 | +'state':'closed', |
| 179 | +'labels': [u"标签1",u"标签2"] |
| 180 | + } |
| 181 | +self.instance.edit(**data) |
| 182 | +self.patch_called_with( |
| 183 | +url_for(), |
| 184 | +data=data |
| 185 | + ) |
| 186 | + |
172 | 187 | deftest_edit(self): |
173 | 188 | """Verify the request for editing an issue.""" |
174 | 189 | data= { |
@@ -324,7 +339,6 @@ def test_replace_labels(self): |
324 | 339 |
|
325 | 340 |
|
326 | 341 | classTestIssueIterators(helper.UnitIteratorHelper): |
327 | | - |
328 | 342 | """Test Issue methods that return iterators.""" |
329 | 343 |
|
330 | 344 | described_class=github3.issues.Issue |
@@ -365,7 +379,6 @@ def test_labels(self): |
365 | 379 |
|
366 | 380 |
|
367 | 381 | classTestLabelRequiresAuth(helper.UnitRequiresAuthenticationHelper): |
368 | | - |
369 | 382 | """Test that ensure certain methods on Label class requires auth.""" |
370 | 383 |
|
371 | 384 | described_class=github3.issues.label.Label |
@@ -430,7 +443,6 @@ def test_update(self): |
430 | 443 |
|
431 | 444 |
|
432 | 445 | classTestIssueEvent(helper.UnitHelper): |
433 | | - |
434 | 446 | """Unit test for IssueEvent.""" |
435 | 447 |
|
436 | 448 | described_class=github3.issues.event.IssueEvent |
|