8000 Support for multiple assignees on issue closing/re-opening · 8R0WNI3/github3.py@c5bc0ff · GitHub
[go: up one dir, main page]

Skip to content

Commit c5bc0ff

Browse files
committed
Support for multiple assignees on issue closing/re-opening
Resolves sigmavirus24#1128 I updated `issue.py` to consider `assignees` also on issue closing as well as re-opening. This prevents extra-assignees from being unassigned if an issue is closed and allows re-opening the issue with the same set of assignees. I adjusted existing tests to also examine `assignees` property for said operations.
1 parent f9f534b commit c5bc0ff

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,5 @@ Contributors
226226
- Thomas Buchner (@MrBatschner)
227227

228228
- Chris Cotter (@ccotter)
229+
230+
- Jonas Brand (@8R0WNI3)

src/github3/issues/issue.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,18 @@ def close(self):
110110
bool
111111
"""
112112
assignee = self.assignee.login if self.assignee else ""
113+
assignees = [a.login for a in self.assignees]
113114
number = self.milestone.number if self.milestone else None
114115
labels = [lbl.name for lbl in self.original_labels]
115116

116117
return self.edit(
117-
self.title, self.body, assignee, "closed", number, labels
118+
self.title,
119+
self.body,
120+
assignee,
121+
"closed",
122+
number,
123+
labels,
124+
assignees,
118125
)
119126

120127
def comment(self, id_num):
@@ -388,10 +395,11 @@ def reopen(self):
388395
bool
389396
"""
390397
assignee = self.assignee.login if self.assignee else ""
398+
assignees = [a.login for a in self.assignees]
391399
number = self.milestone.number if self.milestone else None
392400
labels = [str(lbl) for lbl in self.original_labels]
393401
return self.edit(
394-
self.title, self.body, assignee, "open", number, labels
402+
self.title, self.body, assignee, "open", number, labels, assignees
395403
)
396404

397405
@requires_auth

tests/cassettes/Issue_closed.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDZII8uJ18RkHd3Yw6BQKN3LLqSyrThismQkOZ1r+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQ3NrKJBjTivcLbud12s9UiTWrlMGGFyVdcF2baIi71UG/ajA3pmYGx+EY9ZA35VbpZno8EjiCpkyYf2A8koU7WIslLdk9wOFMJZP2pfArHJDZ4gW5HQyoc1uKrVA8ys6z8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/q7Ss0NRyJQPLjA1mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdm8lgUYuM1OB/GIhFEP0QW1VG9n0n80ZFlljpgp2F5aX3A1Xrp/XHwYAhBUdRRHRk7CoXJ1NIN3VB2O4o75TAmhboG0LX2zN/Zthte+ILV7hhAezQHfFis7ZxBFOJqr4IKbp8p3rzDv10L3GjvluSMZyINm+RHilp4g7VaCqtaPCY+sU5NpXrlCOiZ6G/7AU7qgkt/5wjyGB/4GMH40HXFO7wf+z+ntvUHvHFtcab6gWeNCpFnG+ALCfjR0iwBM21Sui7+57oQkcMumNC9dh86oMOx+NVRR8qP1LUqGZHQaRuET7XR4+nezFX+hpoFd3YQFDcu3TAkFkwKFESNhBss5m9Fa2LWiTkf8fjgYxTF5CR1cvonCSqtCM+OSthTEZfDo40oXo1k4THd1/fJtYd1JMqEMy8FEqOw3PHSxhKlmYOxKBiayFuLh3UB0wb3kAgaokuv19R2RwDEzzYCeTylEAkUhiU9IdEJG1+E4IQNIy3fYr67yvTYkToZREsXOphO3gwGTAUkIcSa0tnOlpyBXZdx3EGz5+fLi4vzT5dX59eUV2KQqb6ZuOsLSpDq7nnMT3HIhgpQF3RZB2gQwf4JJpnJ25u+Bfrfy9t0E+48TXJ2tWJb9cSc7ANpELP0Ou9xs+tz8lA8RSJvX+2j5r7Z3Ar3eR6/30foHDf8n99H9X7wfQpR2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:01 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4994", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"d504ec810dda9aa826cf32f81eb61972\"", "Last-Modified": "Fri, 10 Nov 2017 14:34:03 GMT", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.094360", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17A98:10E8464:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T21:58:01"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"title\": \"Integration test for editing an issue\", \"body\": \"This will be closed by the `issue.closed()`\\n\", \"assignee\": \"\", \"state\": \"closed\", \"labels\": [\"Easy\", \"in progress\"]}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "177"}, "method": "PATCH", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDbIIsuJ18RkHd3Yw6BQKNnLLqSyrThismQkOZ1n+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQwtrKJBjTivcLbhd12s9UiTWrlMGGFyVdcl2baIi71UG/ajA3pmYGx+EY9ZA35VbpZnY6EjiCpkyYf2A8kIU7WIslLdkdwOFMJZP2ufBrHJDZ8hm5HQyoC1uKnVA8yM6T8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/i7Ss0NRyJQPLjA3mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdmilgUYuM3OBvGIhFEP0SW1VO9m0n80ZFVljpgp2F5aX3A1Xrl/WL4fAhBUdRRHRk7CsXJ1NIP3VB2P4p75XAmhboG0K327Nw5thje+ILV7hhCezAHfFiu7YBBFOJqr4IKbx8r3oDDv10L3GjvjuSMZyINm+QniVp4g7VaCqtaPCY+sU5NpXrlCOiV6W/7AU7qgkv/xhXkKD/wNYPxoOuGc3g/8n9LbB4PeOba40nxJs8aFSLOM8SWE/WToDgGYtqlcF3913QlJ4JbNaF66Dp1TYdjdeqii5HvrW5QMyegsjMJH2un49O9mK/5MTQO7ugkLGlZvmRIKJgUKI0bCDJZzNqe1sBtFnY743XAwimPyHDq4fBWFlVaFZsYlbSWIy+DBx7UuRrNwmO7r+unbwrqTZEIZloOJUNkveOhiCVPNwNiVDExkLcT9u4HognvJBQxQJTfrmzsigWNmmgE9n1GIBIpCEr8l0VsymobjhAwgLd9gv7rKt2zOnE0UTiOSxKMkjJxNJ24PQ+JkQBJCnAmt7ULpGchVGfcdBFt+urq8vPh4dX0xvboGm1TlzcxNR1iaVOfTBTfBLRciSFnQbRGkTQDzJ5hkKmfn/h7odyuv30yw/zjB1fmaZdlvd7IjoG3Eyu+4y822z80PeR+BtHm5j1b/agcn0Mt99HIfbX7Q8H9yH939BaEm/gh2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:02 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4993", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"a8bbefe768d759477b6df6a628089e23\"", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.209756", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17AC1:10E848A:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "reco 5811 rded_at": "2017-12-20T21:58:02"}], "recorded_with": "betamax/0.8.0"}
1+
{"http_interactions": [{"request": {"body": {"encoding": "utf-8", "string": ""}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>"}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDZII8uJ18RkHd3Yw6BQKN3LLqSyrThismQkOZ1r+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQ3NrKJBjTivcLbud12s9UiTWrlMGGFyVdcF2baIi71UG/ajA3pmYGx+EY9ZA35VbpZno8EjiCpkyYf2A8koU7WIslLdk9wOFMJZP2pfArHJDZ4gW5HQyoc1uKrVA8ys6z8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/q7Ss0NRyJQPLjA1mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdm8lgUYuM1OB/GIhFEP0QW1VG9n0n80ZFlljpgp2F5aX3A1Xrp/XHwYAhBUdRRHRk7CoXJ1NIN3VB2O4o75TAmhboG0LX2zN/Zthte+ILV7hhAezQHfFis7ZxBFOJqr4IKbp8p3rzDv10L3GjvluSMZyINm+RHilp4g7VaCqtaPCY+sU5NpXrlCOiZ6G/7AU7qgkt/5wjyGB/4GMH40HXFO7wf+z+ntvUHvHFtcab6gWeNCpFnG+ALCfjR0iwBM21Sui7+57oQkcMumNC9dh86oMOx+NVRR8qP1LUqGZHQaRuET7XR4+nezFX+hpoFd3YQFDcu3TAkFkwKFESNhBss5m9Fa2LWiTkf8fjgYxTF5CR1cvonCSqtCM+OSthTEZfDo40oXo1k4THd1/fJtYd1JMqEMy8FEqOw3PHSxhKlmYOxKBiayFuLh3UB0wb3kAgaokuv19R2RwDEzzYCeTylEAkUhiU9IdEJG1+E4IQNIy3fYr67yvTYkToZREsXOphO3gwGTAUkIcSa0tnOlpyBXZdx3EGz5+fLi4vzT5dX59eUV2KQqb6ZuOsLSpDq7nnMT3HIhgpQF3RZB2gQwf4JJpnJ25u+Bfrfy9t0E+48TXJ2tWJb9cSc7ANpELP0Ou9xs+tz8lA8RSJvX+2j5r7Z3Ar3eR6/30foHDf8n99H9X7wfQpR2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:01 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4994", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"d504ec810dda9aa826cf32f81eb61972\"", "Last-Modified": "Fri, 10 Nov 2017 14:34:03 GMT", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "repo", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.094360", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17A98:10E8464:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T21:58:01"}, {"request": {"body": {"encoding": "utf-8", "string": "{\"title\": \"Integration test for editing an issue\", \"body\": \"This will be closed by the `issue.closed()`\\n\", \"assignee\": \"\", \"state\": \"closed\", \"labels\": [\"Easy\", \"in progress\"], \"assignees\": []}"}, "headers": {"User-Agent": "github3.py/1.0.0a4", "Accept-Encoding": "gzip, deflate", "Accept": "application/vnd.github.v3.full+json", "Connection": "keep-alive", "Accept-Charset": "utf-8", "Content-Type": "application/json", "Authorization": "token <AUTH_TOKEN>", "Content-Length": "177"}, "method": "PATCH", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WW2vbMBTHv4oRDDbIIsuJ18RkHd3Yw6BQKNnLLqSyrThismQkOZ1n+t13JCdpcyEtWR/20DfbOuenv85NblGtBUrQwtrKJBjTivcLbhd12s9UiTWrlMGGFyVdcl2baIi71UG/ajA3pmYGx+EY9ZA35VbpZnY6EjiCpkyYf2A8kIU7WIslLdkdwOFMJZP2ufBrHJDZ8hm5HQyoC1uKnVA8yM6T8sJzlJAoGofjOBr3kKzLlGmUQNJ6yHIrGGT/i7Ss0NRyJQPLjA3mSgcs55bLIqAy8IkGObVxri0SquAS/Lg1JSuptdmilgUYuM3OBvGIhFEP0SW1VO9m0n80ZFVljpgp2F5aX3A1Xrl/WL4fAhBUdRRHRk7CsXJ1NIP3VB2P4p75XAmhboG0K327Nw5thje+ILV7hhCezAHfFiu7YBBFOJqr4IKbx8r3oDDv10L3GjvjuSMZyINm+QniVp4g7VaCqtaPCY+sU5NpXrlCOiV6W/7AU7qgkv/xhXkKD/wNYPxoOuGc3g/8n9LbB4PeOba40nxJs8aFSLOM8SWE/WToDgGYtqlcF3913QlJ4JbNaF66Dp1TYdjdeqii5HvrW5QMyegsjMJH2un49O9mK/5MTQO7ugkLGlZvmRIKJgUKI0bCDJZzNqe1sBtFnY743XAwimPyHDq4fBWFlVaFZsYlbSWIy+DBx7UuRrNwmO7r+unbwrqTZEIZloOJUNkveOhiCVPNwNiVDExkLcT9u4HognvJBQxQJTfrmzsigWNmmgE9n1GIBIpCEr8l0VsymobjhAwgLd9gv7rKt2zOnE0UTiOSxKMkjJxNJ24PQ+JkQBJCnAmt7ULpGchVGfcdBFt+urq8vPh4dX0xvboGm1TlzcxNR1iaVOfTBTfBLRciSFnQbRGkTQDzJ5hkKmfn/h7odyuv30yw/zjB1fmaZdlvd7IjoG3Eyu+4y822z80PeR+BtHm5j1b/agcn0Mt99HIfbX7Q8H9yH939BaEm/gh2DAAA", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 21:58:02 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4993", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"a8bbefe768d759477b6df6a628089e23\"", "X-OAuth-Scopes": "admin:org, delete_repo, repo", "X-Accepted-OAuth-Scopes": "", "X-GitHub-Media-Type": "github.v3; param=full; format=json", "Access-Control-Expose-Headers": "ETag, Link, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval", "Access-Control-Allow-Origin": "*", "Content-Security-Policy": "default-src 'none'", "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "deny", "X-XSS-Protection": "1; mode=block", "X-Runtime-rack": "0.209756", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C791:1E7F:E17AC1:10E848A:5A3ADCE9"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T21:58:02"}], "recorded_with": "betamax/0.8.0"}

0 commit comments

Comments
 (0)
0