From c5bc0ff1814e26b25dc57bf48d942c5d6dac321d Mon Sep 17 00:00:00 2001 From: "Jonas Brand (8R0WNI3)" Date: Tue, 20 Aug 2024 17:18:40 +0200 Subject: [PATCH] Support for multiple assignees on issue closing/re-opening Resolves https://github.com/sigmavirus24/github3.py/discussions/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. --- AUTHORS.rst | 2 ++ src/github3/issues/issue.py | 12 ++++++++++-- tests/cassettes/Issue_closed.json | 2 +- tests/cassettes/Issue_reopen.json | 2 +- tests/unit/test_issues_issue.py | 4 ++++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 1946eda3..b4336cda 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -226,3 +226,5 @@ Contributors - Thomas Buchner (@MrBatschner) - Chris Cotter (@ccotter) + +- Jonas Brand (@8R0WNI3) diff --git a/src/github3/issues/issue.py b/src/github3/issues/issue.py index 6588ad4d..76db19b5 100644 --- a/src/github3/issues/issue.py +++ b/src/github3/issues/issue.py @@ -110,11 +110,18 @@ def close(self): bool """ assignee = self.assignee.login if self.assignee else "" + assignees = [a.login for a in self.assignees] number = self.milestone.number if self.milestone else None labels = [lbl.name for lbl in self.original_labels] return self.edit( - self.title, self.body, assignee, "closed", number, labels + self.title, + self.body, + assignee, + "closed", + number, + labels, + assignees, ) def comment(self, id_num): @@ -388,10 +395,11 @@ def reopen(self): bool """ assignee = self.assignee.login if self.assignee else "" + assignees = [a.login for a in self.assignees] number = self.milestone.number if self.milestone else None labels = [str(lbl) for lbl in self.original_labels] return self.edit( - self.title, self.body, assignee, "open", number, labels + self.title, self.body, assignee, "open", number, labels, assignees ) @requires_auth diff --git a/tests/cassettes/Issue_closed.json b/tests/cassettes/Issue_closed.json index c8fdbe95..5d15dfe9 100644 --- a/tests/cassettes/Issue_closed.json +++ b/tests/cassettes/Issue_closed.json @@ -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 "}, "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 ", "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"} +{"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 "}, "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 ", "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"} diff --git a/tests/cassettes/Issue_reopen.json b/tests/cassettes/Issue_reopen.json index 4941eacb..6334d30a 100644 --- a/tests/cassettes/Issue_reopen.json +++ b/tests/cassettes/Issue_reopen.json @@ -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 "}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WXW+bMBSG/wriapPSGEiyNijr1O1qUqVKVXazD6UGHLBmbGQf0jGU/75jk6ZNGmUV68Uucgf4vM85Pl+i9Wst/NgvACoTE0IrPsw5FHUyTFVJNKuUIYbnJV1xXZtoTLrT0bBqCDemZoZMgqk/8J0pB6WbRX8kcgRNmDD/wHgSFulgLZG0ZGuE451KJuG18A84JLPVK3I7GFILKMVeKp5U50V14Zkfh1E0DaaTaDrwZV0mTPsxFm3gAwfBsPqfJbBcU+BKesAMeEulPZZx4DL3qPRcoTGc2lhp6wuVc4k6DqZkJQVIi1rmaGCdnY8mF2EQDXy6okD1fiXdRxNuuswSU4XuJbiGq8lG/mH1foxAjKqjWLJvQzjWrpZmyLOojmfxmflSCaHukbQf+u5sHHJGtloMtXvGFPbmoLYlCgqGWcSr2Q7Ouflb+x4MzOlanF4DC55ZksE6aJb1CG6jxNDuJUbVujXhkHViUs0r20h9srejR57SOZX8t2vMPjzUG8S41dTjnk6H+pfM9sGkd8KWVJqvaNrYFGmWMr7CtPeG7hGQCU1lp/iLnU4sAge2oFlpJ3RJhWHrh6Xqx99+uLqDNU+FMixDgVDpT3zojHFsDe4VydBE1kI8vptOXnKBG0LJ7fl2CcYRLljNkJ4tKKCHKAgnZ2F0Fl7Mg2kcjuJw/BX91VW2Y3NubaJgHkVx8C4ej6xNF9wzTDiJR2EchtaE1lAovcBwVcpdi6DLTzfX11cfb26v5je3aJOorFnY8cejWXU5L7jx7rkQXsK8zoWXNB4OmDdLVcYu3aIbdidv3s6I+zgj1eUDC9gve7MjoF3ERndccrerufsuHzOQNKeFu/kZOThip4V7WrjbPxDynyzc9R+UTw66VwsAAA==", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 22:07:45 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4979", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"f31717830cbe7be8b4a608040947fde6\"", "Last-Modified": "Wed, 20 Dec 2017 22:06:43 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.069380", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C906:1E82:1DFBA8B:23B1763:5A3ADF31"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T22:07:45"}, {"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\": \"open\", \"labels\": []}"}, "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 ", "Content-Length": "154"}, "method": "PATCH", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WXW+bMBSG/wriapPSGGiiNCjr1O1qUqVKVXazD6UGXLBmbGQf0jGU/75jQ7ImjbKK9WIXvUvgvI9fny/R+rUWfuwXAJWJCaEVH+ccijoZp6okmlXKEMPzkq65rk00Id3b83HVEG5MzQyZBnN/5LtQDko3q+FI5AiaMGH+gfHIFulgLZG0ZBuE451KJuGl8Fscktn6BbkdDKkFlOIgFY+q86y68MyPwyiaB/NpNB/5si4Tpv0YizbygYNgWP1PEliuKXAlPWAGvHulPZZx4DL3qPRcodFObay09YXKuUQdB1OykgKkRS1zDLCHzc6nF2EQjXy6pkD1YSXdQxP2XWaJqcLjJbiGq0kvf79+N0EguuooluxbC6fa1dIMeeLqdBafhN8rIdQDkg6t78/GscPITotWu9+YwsEc1LZEQcEwi3g128E5N39r36PGnK7F6TWw4pklGayDZtkAc70SrT1IdNW6NeGQdWJSzSvbSEOyt6dHntI5lfyXa8whPNQbxLjVNOCeTof658z20aR3wpZUmq9p2tgUaZYyvsa0D4YeEJAJTWWn+LOdTiwCB7aiWWkn9J4KwzbbperHX7+7uoMNVxWTGC5U+oPhcLlQHFqDW0UyDJC1EH/+m05ccoH7Qcnd+90KjCNcr5ohO1tRQH4UhNOzMDoLL5bBPA7P43DyBc+rq2wvZmZjomAZRXEwiydTG5MKZXpM76KGQukVmlMpd+2AB3y8ub6++nBze7W8uUVRorJmZUcdXy2qy2XBjffAhfAS5nVAL2k8HCZvkaqMXbqlNu7evHm7IO7hglSXWxawn/YeJ0D7iF53WnK3r7n7ZmvQ3zdpXpdr/+FxdJxel+vrct19bZD/ZLlufgMvTIX5QwsAAA==", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 22:07:45 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4978", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"6532805b54db37bdf0d45b91b28c3ab8\"", "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.229646", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C906:1E82:1DFBAAA:23B1788:5A3ADF31"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T22:07:46"}], "recorded_with": "betamax/0.8.0"} +{"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 "}, "method": "GET", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WXW+bMBSG/wriapPSGEiyNijr1O1qUqVKVXazD6UGHLBmbGQf0jGU/75jk6ZNGmUV68Uucgf4vM85Pl+i9Wst/NgvACoTE0IrPsw5FHUyTFVJNKuUIYbnJV1xXZtoTLrT0bBqCDemZoZMgqk/8J0pB6WbRX8kcgRNmDD/wHgSFulgLZG0ZGuE451KJuG18A84JLPVK3I7GFILKMVeKp5U50V14Zkfh1E0DaaTaDrwZV0mTPsxFm3gAwfBsPqfJbBcU+BKesAMeEulPZZx4DL3qPRcoTGc2lhp6wuVc4k6DqZkJQVIi1rmaGCdnY8mF2EQDXy6okD1fiXdRxNuuswSU4XuJbiGq8lG/mH1foxAjKqjWLJvQzjWrpZmyLOojmfxmflSCaHukbQf+u5sHHJGtloMtXvGFPbmoLYlCgqGWcSr2Q7Ouflb+x4MzOlanF4DC55ZksE6aJb1CG6jxNDuJUbVujXhkHViUs0r20h9srejR57SOZX8t2vMPjzUG8S41dTjnk6H+pfM9sGkd8KWVJqvaNrYFGmWMr7CtPeG7hGQCU1lp/iLnU4sAge2oFlpJ3RJhWHrh6Xqx99+uLqDNU+FMixDgVDpT3zojHFsDe4VydBE1kI8vptOXnKBG0LJ7fl2CcYRLljNkJ4tKKCHKAgnZ2F0Fl7Mg2kcjuJw/BX91VW2Y3NubaJgHkVx8C4ej6xNF9wzTDiJR2EchtaE1lAovcBwVcpdi6DLTzfX11cfb26v5je3aJOorFnY8cejWXU5L7jx7rkQXsK8zoWXNB4OmDdLVcYu3aIbdidv3s6I+zgj1eUDC9gve7MjoF3ERndccrerufsuHzOQNKeFu/kZOThip4V7WrjbPxDynyzc9R+UTw66VwsAAA==", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 22:07:45 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4979", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"f31717830cbe7be8b4a608040947fde6\"", "Last-Modified": "Wed, 20 Dec 2017 22:06:43 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.069380", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C906:1E82:1DFBA8B:23B1763:5A3ADF31"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T22:07:45"}, {"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\": \"open\", \"labels\": [], \"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 ", "Content-Length": "154"}, "method": "PATCH", "uri": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "response": {"body": {"encoding": "utf-8", "base64_string": "H4sIAAAAAAAAA+2WXW+bMBSG/wriapPSGGiiNCjr1O1qUqVKVXazD6UGXLBmbGQf0jGU/75jQ7ImjbKK9WIXvUvgvI9fny/R+rUWfuwXAJWJCaEVH+ccijoZp6okmlXKEMPzkq65rk00Id3b83HVEG5MzQyZBnN/5LtQDko3q+FI5AiaMGH+gfHIFulgLZG0ZBuE451KJuGl8Fscktn6BbkdDKkFlOIgFY+q86y68MyPwyiaB/NpNB/5si4Tpv0YizbygYNgWP1PEliuKXAlPWAGvHulPZZx4DL3qPRcodFObay09YXKuUQdB1OykgKkRS1zDLCHzc6nF2EQjXy6pkD1YSXdQxP2XWaJqcLjJbiGq0kvf79+N0EguuooluxbC6fa1dIMeeLqdBafhN8rIdQDkg6t78/GscPITotWu9+YwsEc1LZEQcEwi3g128E5N39r36PGnK7F6TWw4pklGayDZtkAc70SrT1IdNW6NeGQdWJSzSvbSEOyt6dHntI5lfyXa8whPNQbxLjVNOCeTof658z20aR3wpZUmq9p2tgUaZYyvsa0D4YeEJAJTWWn+LOdTiwCB7aiWWkn9J4KwzbbperHX7+7uoMNVxWTGC5U+oPhcLlQHFqDW0UyDJC1EH/+m05ccoH7Qcnd+90KjCNcr5ohO1tRQH4UhNOzMDoLL5bBPA7P43DyBc+rq2wvZmZjomAZRXEwiydTG5MKZXpM76KGQukVmlMpd+2AB3y8ub6++nBze7W8uUVRorJmZUcdXy2qy2XBjffAhfAS5nVAL2k8HCZvkaqMXbqlNu7evHm7IO7hglSXWxawn/YeJ0D7iF53WnK3r7n7ZmvQ3zdpXpdr/+FxdJxel+vrct19bZD/ZLlufgMvTIX5QwsAAA==", "string": ""}, "headers": {"Date": "Wed, 20 Dec 2017 22:07:45 GMT", "Content-Type": "application/json; charset=utf-8", "Transfer-Encoding": "chunked", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", "X-RateLimit-Remaining": "4978", "X-RateLimit-Reset": "1513807760", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", "ETag": "W/\"6532805b54db37bdf0d45b91b28c3ab8\"", "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.229646", "Content-Encoding": "gzip", "X-GitHub-Request-Id": "C906:1E82:1DFBAAA:23B1788:5A3ADF31"}, "status": {"code": 200, "message": "OK"}, "url": "https://api.github.com/repos/sigmavirus24/github3.py/issues/509"}, "recorded_at": "2017-12-20T22:07:46"}], "recorded_with": "betamax/0.8.0"} diff --git a/tests/unit/test_issues_issue.py b/tests/unit/test_issues_issue.py index e1b12256..9c46d840 100644 --- a/tests/unit/test_issues_issue.py +++ b/tests/unit/test_issues_issue.py @@ -114,6 +114,7 @@ def test_close(self): """Verify the request for closing an issue.""" self.instance.close() labels = [label.name for label in self.instance.original_labels] + assignees = [a.login for a in self.instance.assignees] self.patch_called_with( url_for(), @@ -124,6 +125,7 @@ def test_close(self): "milestone": self.instance.milestone.number or "", "state": "closed", "title": self.instance.title, + "assignees": assignees, }, ) @@ -292,6 +294,7 @@ def test_remove_lock(self): def test_reopen(self): """Test the request for reopening an issue.""" labels = [str(label) for label in self.instance.original_labels] + assignees = [a.login for a in self.instance.assignees] with unittest.mock.patch.object(Issue, "edit") as edit: self.instance.reopen() edit.assert_called_once_with( @@ -301,6 +304,7 @@ def test_reopen(self): "open", self.instance.milestone.number, labels, + assignees, ) def test_replace_labels(self):