Commit 67a1f34c authored by Sebastian Latacz's avatar Sebastian Latacz

Add funtionality to add Milestones to Issues

parent b3caeceb
Pipeline #23418833 passed with stage
in 39 seconds
......@@ -451,3 +451,24 @@ class GitHubIssue(GitHubMixin, Issue):
return {GitHubMergeRequest(self._token, repo_name, int(number))
for repo_name, number in matches}
@property
def milestone(self):
"""
Retrieves the milestone.
"""
from IGitt.GitHub.GitHubMilestone import GitHubMilestone
return GitHubMilestone.from_data(
self.data['milestone'], self._token, self._repository,
self.data['milestone']['number']
) if self.data['milestone'] else None
@milestone.setter
def milestone(self, new_milestone):
"""
Setter for the Milestone.
Delete the Milestone with passing a 'None'
"""
self.data = patch(
self._token, self.url,
{'milestone': new_milestone.number if new_milestone else ''})
......@@ -443,3 +443,24 @@ class GitLabIssue(GitLabMixin, Issue):
self._repository,
mr['iid'])
for mr in mrs if mr['state'] == MergeRequestStates.MERGED.value}
@property
def milestone(self):
"""
Retrieves the milestone.
"""
from IGitt.GitLab.GitLabProjectMilestone import GitLabProjectMilestone
return GitLabProjectMilestone.from_data(
self.data['milestone'], self._token, self._repository,
self.data['milestone']['id']
) if self.data['milestone'] else None
@milestone.setter
def milestone(self, new_milestone):
"""
Setter for the Milestone.
Delete the Milestone with passing a 'None'
"""
self.data = put(
self._token, self.url,
{'milestone_id': new_milestone.number if new_milestone else ''})
......@@ -10,6 +10,7 @@ from IGitt.Interfaces import IGittObject
from IGitt.Interfaces.Comment import Comment
from IGitt.Interfaces.Repository import Repository
from IGitt.Interfaces.User import User
from IGitt.Interfaces.Milestone import Milestone
class Issue(IGittObject):
......@@ -213,3 +214,17 @@ class Issue(IGittObject):
Returns the merge requests that close this issue.
"""
raise NotImplementedError
@property
def milestone(self) -> Milestone:
"""
Retrieves the milestone.
"""
raise NotImplementedError
@milestone.setter
def milestone(self, new_milestone) -> Milestone:
"""
Setter for the Milestone.
"""
raise NotImplementedError
interactions:
- request:
body: '{"milestone": 1}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['16']
Content-Type: [application/json]
User-Agent: [IGitt]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/146
response:
body:
string: !!binary |
H4sIAAAAAAAAA61Wa2/aMBT9K1E+FxIHQiFSNXUDTZUKbG1Yq04TCokX3Doxih2e6n/ftRNSHoU1
hU8Q595zT+7jXK/0NKG6o4+FmHDHMLwJqYZEjNNR1WeRkeAJ4wYcRJ7AFYG5qKQcJ4b8ZxDOU8wN
VG/oF7qyJIIli+GnEQGGeiNM+echNkgZGdbKiL0IvwI2fFCEY3Em9DUaAOPp+WAzLAAdi4ju5GGj
MB8pCQl0p4Za6BLVW/aFHrMAD+WZ3m0PGvePvWXwMFh23Zd5b9kx++7gCqLGaTTCie5AUS90QQTF
YH8jC60Jpsmya11C4YfFWGOxpl5x7R4LgZOq1u5rvb6rtTu3HbcDcLJZdGelUxaSGJA4HlFPwAvJ
AzVNG7VMtE3tZ+PXY4/6z5060Jz33es5mHtTT3jJbluoQ27mDStj+SwWUAvVu6mxDvBlelUHkDDJ
YVQSJLtjrS/huFEQPl6Owuwvo5TNwHOX6/ZcbYIbhQ9Qyv6TOCztDz4rg4kxhjQBddnwIeH/6/Yt
Isp+BePOBTSKROCQ4AQHJcjkHkBlFgOLlZIQBZWOuJ+QiSAsLpOdLT/AYUnoxWTplcUBPw7uSqdK
fI+yB7+PzPhWMjOHlTFJyNTzFzIFCfYxmUI6S4PteAKWWEzkaA7kgEFyicBDL4jkkP31KMevaynV
nd9/VB2FNGcTHIM5Zf4LhiFQpjBdnJMwxmAQp5S+PfPMOVoPvJzkozNzdF0UMLAygMPxgTqgbwWG
gjh5WWxSytcFwCrdtFqWfXm5LU0vDfeB8qfHnjmybNpd3tjd50GtN7vaUs433fyBk8iLQY+0m+9E
iEw+i5g7almFyAEuRgSK1X570tJJABUsNDh7DLRQ6S54+gn2YPluau1eCvNPQ41GE5k184DsWr3n
cN5td2dgfkx2a4dlNw9wguy+x71kwwD9UmK8F/LzunwI6hSJ3sc8Sa334c4n3O9gb2o/FKa0hu9D
lpXzfYTyyr6PcR6R38f9jN5LbR9md3LdgfueTxmHXbM+gXnf2QJKM8ACLmSObpmoWTHrFavuIstB
LafeeoJK5UKzaWNXUNNFtmM3HMuWNkGKhwwWT7Y88rASVB7AIipuyg5weCeoXTGRi5BjIsdqHgja
qJi2tLGbjmlJm50woFWpGLNkCLuM+UTdDuCrvvVvb6+/9u+u3f4dOI1YsMiufrn7CB4Vy39QLuH+
CA0AAA==
headers:
Access-Control-Allow-Origin: ['*']
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']
Cache-Control: ['private, max-age=60, s-maxage=60']
Content-Encoding: [gzip]
Content-Security-Policy: [default-src 'none']
Content-Type: [application/json; charset=utf-8]
Date: ['Tue, 05 Jun 2018 11:58:02 GMT']
ETag: [W/"f5c180cc42841a75586992356a3a4143"]
Referrer-Policy: ['origin-when-cross-origin, strict-origin-when-cross-origin']
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP']
X-Accepted-OAuth-Scopes: ['']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['8A3A:2129:467E24:93A0C2:5B167ACA']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4996']
X-RateLimit-Reset: ['1528202626']
X-Runtime-rack: ['0.211473']
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
- request:
body: '{"milestone": ""}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['17']
Content-Type: [application/json]
User-Agent: [IGitt]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/146
response:
body:
string: !!binary |
H4sIAAAAAAAAA62UXU/bMBSG/0rka4oTaLsSCU1s9GISNBqkG9o0VU5ySD0cO7Kd0jbiv3Psfoz2
glHEVdvkfR+/PR9uSaMFicnU2trElLKaH5fcTpvsOFcV1VArQ/FBxSx0LBjbaQxo6r5RbkwDhkbd
PjkiXsmt0ovJu4mIESwDYd6PeBGKrlgtlayCJ2TjH6pA2g+ib2gIhtnHYVcshE5tJfbq8KIxb2kJ
L0h8Gp1Fn6LuWe+ISFXAxD0j15fj/u3daFn8HC+v04f5aDkMk3R8jqfKpspAkxibekQstwJQ/801
OrAqcG0PrrnADyUhUDLwr0xwC9aCPg4uk2CUpMHl8GqYDhHnhoXELRGq5BJJBjLBLL5wOaJB2IvO
wmg32vf+j7uRyP8OuxhznqQXc5SzGbNM74+Ff2jC9cC6s3IlLfbCz25DNwd8np13EVLqNcYXwaV7
bfQdztBt4NfbsZXdKyHUIzr3s+7u1Us43Xow0uo7l+XBfvS0VNkpYJkwuhv4kpv/TftOEK9vcd2N
xUFxBIMF1lAcEGbtwCiPElO0/grxqCYzuea15UoeUp0dH3KULpnkS3YoB30G7f6eOuD/eD363rLj
O8VcGVpaaz5j+cKVQEMOfIblPBi250SWXdRuNcduwbC43MKEFZVbsnsmDDxtrlIS//7j+2idXNUg
US5U/gC4BF6K22UMLyWgQDZC/PttVuZqs/Cb99urLw7xVtWA7GKCax2TkzAadMJeJ4zSKIrDKD4Z
/MLzmrrY1/RR5jS9QRyeOk0ulFlj1ikaO1V6guFUzn278YCvydXVxZfk5iJNbtCUqWKx2uW1PcOf
zv70DKFeqWzZBgAA
headers:
Access-Control-Allow-Origin: ['*']
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']
Cache-Control: ['private, max-age=60, s-maxage=60']
Content-Encoding: [gzip]
Content-Security-Policy: [default-src 'none']
Content-Type: [application/json; charset=utf-8]
Date: ['Tue, 05 Jun 2018 11:58:03 GMT']
ETag: [W/"2200add5c20b82f86ebf5c7a7d87dc5d"]
Referrer-Policy: ['origin-when-cross-origin, strict-origin-when-cross-origin']
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP']
X-Accepted-OAuth-Scopes: ['']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['8A3C:2129:467EC6:93A22A:5B167ACB']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4995']
X-RateLimit-Reset: ['1528202626']
X-Runtime-rack: ['0.347244']
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: '{}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['2']
Content-Type: [application/json]
User-Agent: [IGitt]
method: GET
uri: https://api.github.com/repos/gitmate-test-user/test/issues/140?per_page=100
response:
body:
string: !!binary |
H4sIAAAAAAAAA62X247aMBCGXyXyNZADpyVSVW27q6rStlQretOqQiExwWoSp7ZDRdG+e38nIRsI
0Aa4IjEzn8cznt/OlmQiIi5ZKZVK1zS9lPVCplbZoufz2BQ05dLEQOwp2lVUqm4mqTD1k8mkzKg0
7YFFOiS3ZIqLzfxiIjCRt6CRvBxRC8osWFsz8WL6AjYWFNNE3Yi+owFM17fDFixAVyqODvJQK8yJ
kqRZFJUFYQFx+/Z46FhOv98hSRYvqCAuqtUhiqmIouqfng3FDV1MI2YRfnhCjZAqRUXPeJgan6cz
4+Hx6XH22ENEuvLE3ZKIhyyBt6SLyFP4Q09l31lDe2LZHeKtPeWJwxLmg9IqN5dG+TxRyFu+zzJz
5/92/WYAZChKjGYTPfm5bapx0qziOZ+6ymzJo4j/hudhrPs9UIeblQ9CKp5ZErb2h8/W5GpFkSaE
rjdnyOS/duZeILn9Fq0p1ZwFmiCRYEGDFsGUHgjld4Iotnm756hsIX3BUsV40iY7e37gcBF6Cfvj
teXAT8I915QW68nt4fc//biXzMJha6aCrT1/o1MgqE/ZGulsDTvwBEttUt1tX3X/ILlM0bkXxLqH
ll4k6ctO9oj7/UdeR6XNeUoTmEfc/0nRBLkpuktKFiYUBgl6/fVdFs5VG+tGPdszZ6W9wkDeEcP5
hjqhRRUjR1wt7PWQSmkHNlc5Z+IMx+Oaxr0q3BcqYi+BzBgfPzClDrTuiMgFtNr5qMHD65uRpQEK
Uwlm8RqUcolQfEE9nH91hWxkpozYHo3ubKsPJT4nlv3TYln6XyGWx0JrWWYsppWENqa8XE1Poa4R
1ibzKo1t4m4nt0fYdcVGYVorbxPZVoSbhPZ63GTcRpqb3EtUWivyvLj1EneIjo+4xAmxG0E7H2h3
LgmwwC3JJY5l33WtQdcZzGzHtSfuYPINlSp1pG4z7NqjmXXn9seuPdY2QUbnHMdFIfnltBqqB3B8
VHdRFzEcn3SogdbItc5PiqhGrmPpSQ+mgVZlasXFHCcQ91l+pmNV76dPT/fvps/3s+kznPQFdC7o
L3wYILxrjiBN2n1ctBSm4vOkdhcO2HJ58V26p7310jzlry6n5O4ExVrwYFPcacsML/CaF/Iv94/3
Do0NAAA=
headers:
Access-Control-Allow-Origin: ['*']
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']
Cache-Control: ['private, max-age=60, s-maxage=60']
Content-Encoding: [gzip]
Content-Security-Policy: [default-src 'none']
Content-Type: [application/json; charset=utf-8]
Date: ['Fri, 18 May 2018 09:58:44 GMT']
ETag: [W/"aaae94a7820363eda86b2f14e6782679"]
Last-Modified: ['Wed, 16 May 2018 09:46:20 GMT']
Referrer-Policy: ['origin-when-cross-origin, strict-origin-when-cross-origin']
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP']
X-Accepted-OAuth-Scopes: [repo]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['A214:64D2:14AA3D8:2B9365C:5AFEA3D4']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4999']
X-RateLimit-Reset: ['1526641124']
X-Runtime-rack: ['0.277168']
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: '{"milestone": 1}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['16']
Content-Type: [application/json]
User-Agent: [IGitt]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/147
response:
body:
string: !!binary |
H4sIAAAAAAAAA62Xb2/aMBDGv0rk10AS/hUiTVO3VtOktkwVe7NpQiExwVoSZ7ZDxVC/+x47IU2h
sAaQkMDm7ufLne+xsyG5iIlHlkpl0rNtP2OdiKllPu8EPLEFzbi0MZH4irYVlaqdSyps/ctmUuZU
2m7/irSIsWSKi/XsZCIwsT+nsTwdUQvKLlgbO/UT+gw2HiihqboQfUsDmK4uhy1YgC5VEu/koVaY
AyXJ8jguC8JC4vW6vUF/NB6MWiTNkzkVxEO1WkQxFVNU/YGnkuJj3T9ailu6qtY9i/HFU2rxVM9L
qhQVHetmYj1MptbN7d3t9Bbx6X1AvA2JecRSsCSdx77CH3phd+QM3LHjtoi/8pUvdgtqJqVTbjWN
CniqkEWz63J76/9x9aEPZCRKjGYTvfixTatx0q7iOZ7IymzB45g/wXM31tcdUYfblQ9CKn6zNGrs
D5+NzdWSIk0IXW/ViMn/7dNXgRj7DRpVqhkLNUEiwYKGDYIpPRDKU4ooNqb5DSqfy0CwTDFslybA
uh84XER+yv76TTnwk3A3CtNgeWMPv/d056tkFg4bOxNs5QdrnQJBA8pWSGdj2I4nWGqd6d77rvsH
yWWKzvww0T208GNJn7ciSLyfv0wdlTbnGU1hHvPgN0UTGFN0l5QsSikMUnT+y1gWzsm2l3WjHu2Z
o0JfYSD2iOF4Qx1QpophEGfLfD2kUuiBLTRv3B1cQeQqxXvRu29UJH4KmbG+fmFKFYJXoXY0rgNg
SKudjxrcvIysPAtRmEo1i2FoRUYt4RkI6uM0rCvkXmbKiN3hcOQ6Pee4WPYOi2Xpf4ZYvhVawzLj
YRpJ6N6Sp6vpIdQ5wrrPPEtj93GXk9s32Ocq7z6yqQjvE5rr8T7jMtK8zz1FpbUiz4o7MPGG6PiY
S5wQ2xm08452G0mABW5JHuk67qjt9Nvd/tTteu7Y649/oIVKHanbDNruaOqMvcHYcwfaJszpjOO4
KCS/XFZD9QSOj+pm6iGGNxYFcGiAfa/rvHfRnWWgVblacjHDCcQDZs50PNXnyd3d9afJ4/V08ohI
9XV0JugfvCYgvHOOIE3avmo0FKbiZaV2Mw7ZYnHyzbqjvfWj+SpYnk4x7gTFmvNwXdxpywzPMTSF
/AcUYbDvmw0AAA==
headers:
Access-Control-Allow-Origin: ['*']
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']
Cache-Control: ['private, max-age=60, s-maxage=60']
Content-Encoding: [gzip]
Content-Security-Policy: [default-src 'none']
Content-Type: [application/json; charset=utf-8]
Date: ['Fri, 18 May 2018 09:59:15 GMT']
ETag: [W/"5e5331e15ea935fdf505e37a199eda2a"]
Referrer-Policy: ['origin-when-cross-origin, strict-origin-when-cross-origin']
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP']
X-Accepted-OAuth-Scopes: ['']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['A218:64CD:F578F0:234CA3E:5AFEA3F3']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4998']
X-RateLimit-Reset: ['1526641124']
X-Runtime-rack: ['0.219994']
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
- request:
body: '{"milestone": ""}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['17']
Content-Type: [application/json]
If-None-Match: [W/"5e5331e15ea935fdf505e37a199eda2a"]
User-Agent: [IGitt]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/147
response:
body:
string: !!binary |
H4sIAAAAAAAAA62VYW/aMBCG/0rkz4CTFlaINE3d2m+0SIh96TQhJzmCNcfO7AsVi/rfd04Co2ij
A1VCIiT3Pj7u7r3UrLKKxWyNWLqYc1HKQS5xXSWD1BTcQmkcpxuFQOgjOOxXDiz3V1w6V4Hj0fCG
9VgTKdHY7fJiImGUSEC5yxEHSfGWVXMtCnghNv2hAjS+E31HIzBs3g/bsgi6xkId1eGgMf9oSVkp
1TVEZiy+vroeDceT0bjHdFUkYFlM3eoxlKiAuv5otAP6BA/zAE3guxo8SEVfRkNgtL/vABHsILib
BY+zRXB3P71f3FN+fg5YXDNlcqmJ5SBRAumBPzgah6NoEkY9JjYChT1uaHPThd2oeVRqNFIVm6mr
+E7/afNxSMjcdhjPZv7wU0PrcY7v8zldyH3Yyihlnkl5nOtrRxzC+V5DKbXXUudn60lTc4NroDJR
6n5Uc+nemtNXiTTxNRnV4VJmnuCowBayM5LpFJTKs6Ys6sb8DapKXGpliZLG5RzgoY44xuZCy1/i
XA7pHMmbDXPG8U086f7Hna+K2QpqXlq5EenWl8BCCnJD5TwbdqQkFm5L772v3j9UXImwFFnhPbQS
ysHLbgmy+Nv3po/ow00JmsKVSX8AmaAJJXc5J3MNFKDJ+X9+u1Zc7Ly8e75fWnFI+9ACsbMluTZm
V2E07oejfvRhEU7i0TC+Cp/ovKrM/hIzXkRhHIbx9Y2PSZVxHabLosK1sUtKzqSyaTcd8GU2nd5+
ns1vF7M5ifymWlr4SW8QOr4+7eiTryFP2r2FTnv97aWZydXq4qU78Gr/1wSm68spjZzRGCQm27br
rqtwQj99hV9+A1TeSm22BwAA
headers:
Access-Control-Allow-Origin: ['*']
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']
Cache-Control: ['private, max-age=60, s-maxage=60']
Content-Encoding: [gzip]
Content-Security-Policy: [default-src 'none']
Content-Type: [application/json; charset=utf-8]
Date: ['Fri, 18 May 2018 10:00:38 GMT']
ETag: [W/"df04314a99523a87d46e5c7d3b5d1a46"]
Referrer-Policy: ['origin-when-cross-origin, strict-origin-when-cross-origin']
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP']
X-Accepted-OAuth-Scopes: ['']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['A21A:64D2:14AD9D6:2B9A540:5AFEA445']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4997']
X-RateLimit-Reset: ['1526641124']
X-Runtime-rack: ['0.263413']
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
......@@ -5,6 +5,7 @@ from IGitt.GitHub import GitHubToken
from IGitt.GitHub.GitHubIssue import GitHubIssue
from IGitt.GitHub.GitHubUser import GitHubUser
from IGitt.Interfaces import IssueStates
from IGitt.GitHub.GitHubMilestone import GitHubMilestone
from tests import IGittTestCase
......@@ -92,3 +93,14 @@ class GitHubIssueTest(IGittTestCase):
def test_mrs_closed_by(self):
issue = GitHubIssue(self.token, 'gitmate-test-user/test', 131)
self.assertEqual({int(i.number) for i in issue.mrs_closed_by}, {132})
def test_milestone_setter(self):
issue = GitHubIssue(self.token, 'gitmate-test-user/test', 146)
print(issue.url)
#self.assertEqual(issue.milestone, None)
issue.milestone = GitHubMilestone(self.token, 'gitmate-test-user/test',
1)
self.assertEqual(issue.milestone.title,
'Permanent IGitt test milestone. DO NOT DELETE.')
issue.milestone = None
self.assertEqual(issue.milestone, None)
interactions:
- request:
body: '{"milestone_id": 513937}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['24']
Content-Type: [application/json]
User-Agent: [IGitt]
method: PUT
uri: https://gitlab.com/api/v4/projects/gitmate-test-user%2Ftest/issues/42
response:
body: {string: '{"id":10698538,"iid":42,"project_id":3439658,"title":"Issue to
test Milestone on Issues Setter. DO NOT DELETE","description":"","state":"opened","created_at":"2018-05-07T14:15:27.639Z","updated_at":"2018-05-08T09:57:14.579Z","closed_at":null,"closed_by":null,"labels":[],"milestone":{"id":513937,"iid":1,"project_id":3439658,"title":"Permanent
IGitt test milestone. DO NOT DELETE.","description":"Description update to
test updated getter","state":"active","created_at":"2018-04-25T09:11:00.029Z","updated_at":"2018-04-30T11:22:02.350Z","due_date":null,"start_date":null},"assignees":[],"author":{"id":463976,"name":"Sebastian
Latacz","username":"seblat","state":"active","avatar_url":"https://assets.gitlab-static.net/uploads/-/system/user/avatar/463976/avatar.png","web_url":"https://gitlab.com/seblat"},"assignee":null,"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"discussion_locked":null,"web_url":"https://gitlab.com/gitmate-test-user/test/issues/42","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"_links":{"self":"https://gitlab.com/api/v4/projects/3439658/issues/42","notes":"https://gitlab.com/api/v4/projects/3439658/issues/42/notes","award_emoji":"https://gitlab.com/api/v4/projects/3439658/issues/42/award_emoji","project":"https://gitlab.com/api/v4/projects/3439658"},"subscribed":true,"weight":null}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Length: ['1416']
Content-Type: [application/json]
Date: ['Tue, 08 May 2018 09:57:15 GMT']
Etag: [W/"54395ccd57690724d85ce2abf48b8e9f"]
RateLimit-Limit: ['600']
RateLimit-Observed: ['2']
RateLimit-Remaining: ['598']
RateLimit-Reset: ['1525773495']
RateLimit-ResetTime: ['Wed, 08 May 2018 09:58:15 GMT']
Server: [nginx]
Strict-Transport-Security: [max-age=31536000]
Vary: [Origin]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [4b735d1a-84f3-4158-9e1a-f76f974935fa]
X-Runtime: ['1.603700']
status: {code: 200, message: OK}
- request:
body: '{"milestone_id": ""}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['20']
Content-Type: [application/json]
If-None-Match: [W/"54395ccd57690724d85ce2abf48b8e9f"]
User-Agent: [IGitt]
method: PUT
uri: https://gitlab.com/api/v4/projects/gitmate-test-user%2Ftest/issues/42
response:
body: {string: '{"id":10698538,"iid":42,"project_id":3439658,"title":"Issue to
test Milestone on Issues Setter. DO NOT DELETE","description":"","state":"opened","created_at":"2018-05-07T14:15:27.639Z","updated_at":"2018-05-08T09:57:16.727Z","closed_at":null,"closed_by":null,"labels":[],"milestone":null,"assignees":[],"author":{"id":463976,"name":"Sebastian
Latacz","username":"seblat","state":"active","avatar_url":"https://assets.gitlab-static.net/uploads/-/system/user/avatar/463976/avatar.png","web_url":"https://gitlab.com/seblat"},"assignee":null,"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"discussion_locked":null,"web_url":"https://gitlab.com/gitmate-test-user/test/issues/42","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"_links":{"self":"https://gitlab.com/api/v4/projects/3439658/issues/42","notes":"https://gitlab.com/api/v4/projects/3439658/issues/42/notes","award_emoji":"https://gitlab.com/api/v4/projects/3439658/issues/42/award_emoji","project":"https://gitlab.com/api/v4/projects/3439658"},"subscribed":true,"weight":null}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Length: ['1132']
Content-Type: [application/json]
Date: ['Tue, 08 May 2018 09:57:17 GMT']
Etag: [W/"0e14fd146ed0c5aa0b33221abdffb0d9"]
RateLimit-Limit: ['600']
RateLimit-Observed: ['1']
RateLimit-Remaining: ['599']
RateLimit-Reset: ['1525773497']
RateLimit-ResetTime: ['Wed, 08 May 2018 09:58:17 GMT']
Server: [nginx]
Strict-Transport-Security: [max-age=31536000]
Vary: [Origin]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [838f681f-d027-46a6-8588-989081083bde]
X-Runtime: ['1.212177']
status: {code: 200, message: OK}
- request:
body: '{}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['2']
Content-Type: [application/json]
User-Agent: [IGitt]
method: GET
uri: https://gitlab.com/api/v4/projects/gitmate-test-user%2Ftest/issues/42?per_page=100
response:
body: {string: '{"id":10698538,"iid":42,"project_id":3439658,"title":"Issue to
test Milestone on Issues Setter. DO NOT DELETE","description":"","state":"opened","created_at":"2018-05-07T14:15:27.639Z","updated_at":"2018-05-08T09:57:16.727Z","closed_at":null,"closed_by":null,"labels":[],"milestone":null,"assignees":[],"author":{"id":463976,"name":"Sebastian
Latacz","username":"seblat","state":"active","avatar_url":"https://assets.gitlab-static.net/uploads/-/system/user/avatar/463976/avatar.png","web_url":"https://gitlab.com/seblat"},"assignee":null,"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"discussion_locked":null,"web_url":"https://gitlab.com/gitmate-test-user/test/issues/42","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"_links":{"self":"https://gitlab.com/api/v4/projects/3439658/issues/42","notes":"https://gitlab.com/api/v4/projects/3439658/issues/42/notes","award_emoji":"https://gitlab.com/api/v4/projects/3439658/issues/42/award_emoji","project":"https://gitlab.com/api/v4/projects/3439658"},"subscribed":true,"weight":null}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Length: ['1132']
Content-Type: [application/json]
Date: ['Tue, 05 Jun 2018 11:54:17 GMT']
Etag: [W/"0e14fd146ed0c5aa0b33221abdffb0d9"]
RateLimit-Limit: ['600']
RateLimit-Observed: ['1']
RateLimit-Remaining: ['599']
RateLimit-Reset: ['1528199717']
RateLimit-ResetTime: ['Wed, 05 Jun 2018 11:55:17 GMT']
Server: [nginx]
Strict-Transport-Security: [max-age=31536000]
Vary: [Origin]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [a51e98db-a2b2-473e-986a-412fe3a37621]
X-Runtime: ['0.271482']
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: '{}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['2']
Content-Type: [application/json]
User-Agent: [IGitt]
method: GET
uri: https://gitlab.com/api/v4/projects/gitmate-test-user%2Ftest/merge_requests/76?per_page=100
response:
body: {string: '{"id":9411341,"iid":76,"project_id":3439658,"title":"commit to
create pr for milestone testing","description":"","state":"opened","created_at":"2018-04-25T09:28:32.429Z","updated_at":"2018-04-25T09:28:43.100Z","target_branch":"master","source_branch":"seblat/milestonetesting","upvotes":0,"downvotes":0,"author":{"id":463976,"name":"Sebastian
Latacz","username":"seblat","state":"active","avatar_url":"https://assets.gitlab-static.net/uploads/-/system/user/avatar/463976/avatar.png","web_url":"https://gitlab.com/seblat"},"assignee":null,"source_project_id":3439658,"target_project_id":3439658,"labels":[],"work_in_progress":false,"milestone":{"id":513937,"iid":1,"project_id":3439658,"title":"Permanent
IGitt test milestone. DO NOT DELETE.","description":"Description update to
test updated getter","state":"active","created_at":"2018-04-25T09:11:00.029Z","updated_at":"2018-04-30T11:22:02.350Z","due_date":null,"start_date":null},"merge_when_pipeline_succeeds":false,"merge_status":"can_be_merged","sha":"78b4b35183d49d87917ec66dbfd3346fdad7fb33","merge_commit_sha":null,"user_notes_count":0,"discussion_locked":null,"should_remove_source_branch":null,"force_remove_source_branch":false,"web_url":"https://gitlab.com/gitmate-test-user/test/merge_requests/76","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"subscribed":false,"changes_count":"1","merged_by":null,"merged_at":null,"closed_by":null,"closed_at":null,"latest_build_started_at":"2018-04-25T09:28:54.490Z","latest_build_finished_at":"2018-04-25T09:29:13.631Z","first_deployed_to_production_at":null,"pipeline":{"id":21058329,"sha":"78b4b35183d49d87917ec66dbfd3346fdad7fb33","ref":"seblat/milestonetesting","status":"success"},"diff_refs":{"base_sha":"3f49e40b56723a773c8d817a815c5a4a26115df7","head_sha":"78b4b35183d49d87917ec66dbfd3346fdad7fb33","start_sha":"3f49e40b56723a773c8d817a815c5a4a26115df7"},"approvals_before_merge":null,"squash":false}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Length: ['1974']
Content-Type: [application/json]
Date: ['Fri, 18 May 2018 10:32:21 GMT']
Etag: [W/"edecf14db2073911ff813dce84af049c"]
RateLimit-Limit: ['600']
RateLimit-Observed: ['1']
RateLimit-Remaining: ['599']
RateLimit-Reset: ['1526639601']
RateLimit-ResetTime: ['Sat, 18 May 2018 10:33:21 GMT']
Server: [nginx]
Strict-Transport-Security: [max-age=31536000]
Vary: [Origin]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [SAMEORIGIN]
X-Request-Id: [5799b1ea-f2eb-4b28-a322-03103cd2667b]
X-Runtime: ['0.994977']
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: '{"milestone_id": 513937}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['24']
Content-Type: [application/json]
User-Agent: [IGitt]
method: PUT
uri: https://gitlab.com/api/v4/projects/gitmate-test-user%2Ftest/merge_requests/77
response:
body: {string: '{"id":9967635,"iid":77,"project_id":3439658,"title":"Nonsense
MR to test Milestones on MR implementation. DO NOT DELETE.","description":"","state":"opened","created_at":"2018-05-18T10:23:02.196Z","updated_at":"2018-05-18T14:40:05.630Z","target_branch":"gitmate-test-user-patch-1","source_branch":"hello","upvotes":0,"downvotes":0,"author":{"id":463976,"name":"Sebastian
Latacz","username":"seblat","state":"active","avatar_url":"https://assets.gitlab-static.net/uploads/-/system/user/avatar/463976/avatar.png","web_url":"https://gitlab.com/seblat"},"assignee":null,"source_project_id":3439658,"target_project_id":3439658,"labels":[],"work_in_progress":false,"milestone":{"id":513937,"iid":1,"project_id":3439658,"title":"Permanent
IGitt test milestone. DO NOT DELETE.","description":"Description update to