Commit 767a894f authored by Meet Mangukiya's avatar Meet Mangukiya

test_github_issue: Add tests for GitHubIssue

- Add unittests for the GitHubIssue.
- Install VCRpy in gitlab CI.
- Disable doctesting.

Adds to #34
parent 79084b8e
......@@ -2,12 +2,21 @@
ignore = .ci/**, build/**
[autopep8]
files = **/*.py
bears = PEP8Bear
default_actions = PEP8Bear: ApplyPatchAction
[python]
files = **/*.py
bears = PyUnusedCodeBear, PyLintBear
use_spaces = True
pylint_disable = R0903, C0411, C0326, C1801
[python.code]
files = **/*.py
ignore = tests/**.py
[python.tests]
files = tests/**.py
# ignore C0111 to allow test methods without docstrings
# ignore C0103 to allow lowercase constants
# ignore E0401 to allow 'unable to import' results
pylint_disable += C0103, C0111, E1120, E0401
......@@ -2,7 +2,7 @@ run_tests:
image: python:3
script:
- pip install -r requirements.txt
- pip install pytest pytest-cov
- pip install -r test-requirements.txt
- python3 -m pytest
check_code:
......
[tool:pytest]
addopts = --doctest-modules --cov=IGitt --cov-report term-missing
addopts =
tests
--cov=IGitt
--cov-report term-missing
--doctest-modules
--doctest-glob IGitt/Interfaces/*.py
norecursedirs =
.git
dist
......
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
User-Agent: [GitMate]
method: GET
uri: https://api.github.com/repos/gitmate-test-user/test/issues/39
response:
body:
string: !!binary |
H4sIAAAAAAAAA+2W327aMBTGX6XyNdRAKJRI015iu9k6ISc5BKuOHdkOiEW8+z4nga4pYm3Ui10g
uEicc34+Pn++pGaVVSxmW+9LF3MuSnmfS7+tkvvUFNxSaRzHQiE8jT05P64cWR6uuHSuIsejFRux
xlB6Yw/rwUBglEhIueGIl5h4i6q5FgUdgcZxCtL+c+AnGLi0+zRqiwJz6wvVS8JfRXlHOWTG4lkU
PUbRfPo4YroqErIsjlYj5qVXhIpr2t+11yMWasrimimTS41nBREqrvPqWR4E4gm45WI2eYiiERM7
4YXt16hZdFHXPAGYGu2RmqaPKt65f919iQDMbUcJZIaFq00TaI73g7qepL71xihl9uD0A3/d8Be2
4mdXxNleS50PxcC15sZvCRnEsUJn5tL9qy0vhdW41RhO59cyCyCHEljKPh5a54jA9hox1c3cN8Qq
camVpZdGD8jcK3fgjM2Flr/FQBzcHSiN1nz8kI0b3N8zsJfy3frVvLRyJ9JDSI+llOQOGR/K7AGA
9IcyTOf3MJHIv/S0FlkRpnIjlKPjSSNZ/LNu5hJjuYyW8wXG/OoQXZXyVix5RgU2DYqJENqb1CgD
bWCUhR+eZrQRlfKneH41beeDgylJw0CZ9BmWbbyQC+dkrgkGulLq5d7hBHAupMK7xOjz87O0xguI
tiWws7XAfmw2mS7HkwX+3yarOFrE04cf2K8qs4s200k8m8TzVbBJlXEdpo0iMdkByPAeu8vo3ONP
9ikcoTNPYHITRaj3W/29ieJNFPFtwP8PUTz+AR2ZGjbHCgAA
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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, 06 Jun 2017 10:22:10 GMT']
ETag: [W/"ba59207d690441122227fee0731c02f7"]
Last-Modified: ['Tue, 06 Jun 2017 10:20:49 GMT']
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP', Accept-Encoding]
X-Accepted-OAuth-Scopes: ['public_repo, repo']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['E8C0:13F62:7941366:9EAD7E8:59368251']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4907']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.053497']
X-Served-By: [4537b68c46a1b65b106078b0a2578ee2]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
This diff is collapsed.
interactions:
- request:
body: '{"title": "test title", "body": "test body"}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['44']
Content-Type: [application/json]
User-Agent: [GitMate]
method: POST
uri: https://api.github.com/repos/gitmate-test-user/test/issues
response:
body: {string: '{"url":"https://api.github.com/repos/gitmate-test-user/test/issues/41","repository_url":"https://api.github.com/repos/gitmate-test-user/test","labels_url":"https://api.github.com/repos/gitmate-test-user/test/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/gitmate-test-user/test/issues/41/comments","events_url":"https://api.github.com/repos/gitmate-test-user/test/issues/41/events","html_url":"https://github.com/gitmate-test-user/test/issues/41","id":233845558,"number":41,"title":"test
title","user":{"login":"meetmangukiya","id":7620533,"avatar_url":"https://avatars3.githubusercontent.com/u/7620533?v=3","gravatar_id":"","url":"https://api.github.com/users/meetmangukiya","html_url":"https://github.com/meetmangukiya","followers_url":"https://api.github.com/users/meetmangukiya/followers","following_url":"https://api.github.com/users/meetmangukiya/following{/other_user}","gists_url":"https://api.github.com/users/meetmangukiya/gists{/gist_id}","starred_url":"https://api.github.com/users/meetmangukiya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meetmangukiya/subscriptions","organizations_url":"https://api.github.com/users/meetmangukiya/orgs","repos_url":"https://api.github.com/users/meetmangukiya/repos","events_url":"https://api.github.com/users/meetmangukiya/events{/privacy}","received_events_url":"https://api.github.com/users/meetmangukiya/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-06T10:22:34Z","updated_at":"2017-06-06T10:22:34Z","closed_at":null,"body":"test
body","closed_by":null}'}
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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-Length: ['1687']
Content-Security-Policy: [default-src 'none']
Content-Type: [application/json; charset=utf-8]
Date: ['Tue, 06 Jun 2017 10:22:35 GMT']
ETag: ['"c47c17ae7d127eb3b73177c644a37762"']
Location: ['https://api.github.com/repos/gitmate-test-user/test/issues/41']
Server: [GitHub.com]
Status: [201 Created]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP', Accept-Encoding]
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: ['E8D6:13F61:6FD7526:9270498:59368269']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4896']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.109382']
X-Served-By: [ef96c2e493b28ffea49b891b085ed2dd]
X-XSS-Protection: [1; mode=block]
status: {code: 201, message: Created}
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
User-Agent: [GitMate]
method: GET
uri: https://api.github.com/repos/gitmate-test-user/test/issues/41
response:
body:
string: !!binary |
H4sIAAAAAAAAA62U22rjMBCGX2XRdVI5dtIWQ9mX2L3ZZQmyPXVEZcnokJI1eff9JSfp1oQeTMEX
sjT/p9GcBhasYiXbed+7knPRy5tW+l2obmrTcUu9cRwbnfC09OT8MjiyPK64dC6Q4+sVW7BkKL2x
h+1sIDBKVKTcfMSLT3xEDVyLjo5A4zkdaf818DMMXNp/GXVEgbnznZoE4b+kfCAdsmFlXhT3681m
c79gOnQVWVauVwvmpVeEjMcUfht/FiwmlZUDU6aVGocdEVKu2/AkDwIORd7dbZ5timLBxF54YadJ
SpuuOFVPBNZGe8QmFVLgJ/n3/UMBYGtPlEhm2HizaiLN8alTb0dpav1olDLP4Ewdf13xV67iFyn8
HNdSt3MxkA7c+B0hgnhWLM1Wuvfq8ppbSTagO53fyiaCHFJgqfm8aychHHvW8GlIjZ+IoXK1lb2X
Rs+I3Cs5cMa2Qsu/YiYOcgdKGjaff2SSQf6Rjr0W71E38N7KvagPMTyWapJ7RHwucwIA0h/62J4/
Y0ci/tLTVjRd7MpHoRwdz0OSlb//pIz7aG560jBXpn4idFQyRac6J1tNMNBBqZd/N4o7qTAEjL6c
X8ZamWFgWgK72QoPfp6t7pbZLb4fq6zM87JY/8J9oW/etamVcSfM6EVlmsN5AKU17hptKuxHm+M/
LMb1FpcGAAA=
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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, 06 Jun 2017 10:22:39 GMT']
ETag: [W/"c47c17ae7d127eb3b73177c644a37762"]
Last-Modified: ['Tue, 06 Jun 2017 10:22:34 GMT']
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: ['public_repo, repo']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['9676:13F60:35E2499:467E47A:5936826D']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4895']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.045464']
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: '{"labels": ["dem"]}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['19']
Content-Type: [application/json]
User-Agent: [GitMate]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/39
response:
body:
string: !!binary |
H4sIAAAAAAAAA+2W247aMBCGX2Xla1gD4Rip6ku0N+1WyCRDsNaxI9sB0Yh37+8ksN0sorvRXvQC
wUXizHwez+FPKlZaxWK2875wMeeikI+Z9Lty85iYnFsqjONYyIWnoSfnh6Ujy8MVl86V5Hi0YgNW
G0pv7HHdGwiMEhtSrj/iJSbeoCquRU4noHGcnLT/HPgZBi7tP43aoMDc+Vx1kvBXUd5RDpmyeBJF
yyiajpcDpst8Q5bF0WrAvPSKUHFNh4fmesBCTVlcMWUyqfEsJ0LFdVY+y6NAPAG3mE9GsygaMLEX
XthujepFF7XNE4CJ0R6pqfuo5K371/2XCMDMtpRAZli42TSB5ng3qNtJ6lpvjVLmAE438NcNf2Ur
fnFFnM211FlfDFwrbvyOkEEcK3RmJt2/2vJaWLVbheF0fi3TAHIogaX046G1jgjsoBFTVc99TSw3
LrGy8NLoHpl75Q6csZnQ8rfoiYO7A6XWmo8fsnaD+3sG9lq+G7+KF1buRXIM6bGUkNwj432ZHQCQ
/liE6fweJhL5l57WIs3DVG6FcnQ6aySLf1b1XGIsF9FiOseY3xyim1LeiCVPKcemQTERQnOTGGWg
DYzS8MPTlLaiVP4cz6+67XxwMAVpGCiTPMOyiRdy4ZzMNMFAl0q93DucAM65VHiXGH15fpHWeAHR
tgR2uhbYj01G48VwNMf/22gVR/N4PPuB/coivWozHsWTaTxbBptEGddimig2Jj0CGd5jDyldevzJ
PoUjtOYbmNxFEer9Vn/vongXRXwb8P9DFE9/AIxEil7HCgAA
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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, 06 Jun 2017 10:24:58 GMT']
ETag: [W/"35a947c9bd13c5b250eacf4b4e4b14be"]
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP', Accept-Encoding]
X-Accepted-OAuth-Scopes: ['public_repo, repo']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['9688:13F62:794737C:9EB5467:593682F8']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4892']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.095844']
X-Served-By: [7b641bda7ec2ca7cd9df72d2578baf75]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
User-Agent: [GitMate]
method: GET
uri: https://api.github.com/repos/gitmate-test-user/test/labels
response:
body:
string: !!binary |
H4sIAAAAAAAAA63OOw6DMAyA4bt4BgwF8chVUAdDTEFKGpTHVPXuTdQBdWorIS+/PVjf+IBNgqir
pmz6oS8zCFaBgNX73QlE2rfitvk1TMVsNFrejcN40OQ59+x8HhxbTIWKJlYOCTK4k+b4JeVslLGx
WaaJB8kLBeVBLKQcP7NPQXWCYDoEKf8TdMMJgvkQpPxR0F7Kru6atj9BIFkfhvfyTXF9ATdUVVkN
AgAA
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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, 06 Jun 2017 10:24:59 GMT']
ETag: [W/"6c83baee14f79db808b21c7b8b96fdcc"]
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP', Accept-Encoding]
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: ['968A:13F60:35E472A:46811DA:593682FB']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4891']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.021778']
X-Served-By: [02ea60dfed58b2a09106fafd6ca0c108]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: '{"state": "closed"}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['19']
Content-Type: [application/json]
User-Agent: [GitMate]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/39
response:
body:
string: !!binary |
H4sIAAAAAAAAA+2W227iMBCGX6XyNdSAKZRIq32J3ZvdrpBJhmDVsSPbAbER776/Ew4tRbSNerEX
CC6cZObzeA5/UrPKaZawVQilTziXpbrPVVhVi/vUFtxRaT3HjUIG6gfyoV95cjyuuPK+Is/FjPVY
Y6iCddt5ZyAwWi5I++6IU0y8RdXcyIJ2QOM4BZnwNfADDFxafxm1RYG5CoU+S8KLonygHCpjyUiI
RyHGw8ceM1WxIMcSMeuxoIImVNzQ5q5d91isKUtqpm2uDJ4VRKi4yatntZWIJ+Kmk9HgQYgek2sZ
pDuvUXPTi33zRGBqTUBqmj6q+N79+/qbADB3e0okM9y42jSR5vl5UNeTdG69tFrbDTjngb9u+Atb
8aMr4mzXyuRdMXCtuQ0rQgZxrNiZufLvteWlsBq3GsPpw1xlEeRRAkfZ50PbOyKwjUFMdTP3DbFa
+NSpMihrOmTulTtw1uXSqL+yIw7uHpRGaz5/yMYN7h8Z2Ev5bv1qXjq1luk2psdRSmqNjHdlngGA
DNsyTufPOJHIvwo0l1kRp3IptafdQSNZ8rtu5hJjORXT8QRjfnWIrkp5K5Y8owKbRsVECO1FarWF
NjDK4g9PM1rKSodDPH+atgvRIdXWNybaps9YtBFDMLxXuSGYmErr07XHGeBeKI23iTXH50dxTaaQ
bUegZ3OJHdloMJz2BxP8fwxmiZgkw4df2K8qs4s2w0EyGiVjEW3a4N5gXposbLbFJvHddpfRse+f
3JM5ARYwuQklFP2tJt+E8iaU+F7g/4dQ7v4BgUoUl9sKAAA=
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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, 06 Jun 2017 10:22:44 GMT']
ETag: [W/"f0f18af4874ebe59ae70fad3888a1dba"]
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP', Accept-Encoding]
X-Accepted-OAuth-Scopes: ['public_repo, repo']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['9678:13F61:6FD79EB:9270AC3:59368272']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4894']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.112739']
X-Served-By: [2d7a5e35115884240089368322196939]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
- request:
body: '{"state": "open"}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['17']
Content-Type: [application/json]
User-Agent: [GitMate]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/39
response:
body:
string: !!binary |
H4sIAAAAAAAAA+2W327aMBTGX6XyNdRACpRI015iu9k6ISc5BKuOHdkOiEW8+z4nga4pYm3Ui10g
uEicc34+Pn++pGaVVSxmW+9LF3MuSnmfS7+tkvvUFNxSaRzHQiE8jT05P64cWR6uuHSuIsejFRux
xlB6Yw/rwUBglEhIueGIl5h4i6q5FgUdgcZxCtL+c+AnGLi0+zRqiwJz6wvVS8JfRXlHOWTG4lkU
PUbRw/RxxHRVJGRZHK1GzEuvCBXXtL9rr0cs1JTFNVMmlxrPCiJUXOfVszwIxBNwy8VsMo+iERM7
4YXt16hZdFHXPAGYGu2RmqaPKt65f919iQDMbUcJZIaFq00TaI73g7qepL71xihl9uD0A3/d8Be2
4mdXxNleS50PxcC15sZvCRnEsUJn5tL9qy0vhdW41RhO59cyCyCHEljKPh5a54jA9hox1c3cN8Qq
camVpZdGD8jcK3fgjM2Flr/FQBzcHSiN1nz8kI0b3N8zsJfy3frVvLRyJ9JDSI+llOQOGR/K7AGA
9IcyTOf3MJHIv/S0FlkRpnIjlKPjSSNZ/LNu5hJjuYyWDwuM+dUhuirlrVjyjApsGhQTIbQ3qVEG
2sAoCz88zWgjKuVP8fxq2s4HB1OShoEy6TMs23ghF87JXBMMdKXUy73DCeBcSIV3idHn52dpjZcQ
bUtgZ2uB/dhsMl2OJwv8v01WcbSIp/Mf2K8qs4s200k8m8XzSbBJlXEdpo0iMdkByPAeu8vo3ONP
9ikcoTNPYHITRaj3W/29ieJNFPFtwP8PUTz+Ab0U8frHCgAA
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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, 06 Jun 2017 10:22:50 GMT']
ETag: [W/"a9950d204cb480256a2dea6b82a40f2e"]
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP', Accept-Encoding]
X-Accepted-OAuth-Scopes: ['public_repo, repo']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['E8DC:13F60:35E2719:467E7B8:59368276']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4893']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.158940']
X-Served-By: [77fbfb53269bbb85f82f23584d59f7c1]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: '{"title": "new title"}'
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
Content-Length: ['22']
Content-Type: [application/json]
User-Agent: [GitMate]
method: PATCH
uri: https://api.github.com/repos/gitmate-test-user/test/issues/39
response:
body:
string: !!binary |
H4sIAAAAAAAAA+2W247aMBCGX2Xla1gD4Rip6ku0N+1WyCRDsNaxI9sB0Yh37+8ksN0sorvRXvQC
wUXizHwez+FPKlZaxWK2875wMeeikI+Z9Lty85iYnFsqjONYyIWnoSfnh6Ujy8MVl86V5Hi0YgNW
G0pv7HHdGwiMEhtSrj/iJSbeoCquRU4noHGcnLT/HPgZBi7tP43aoMDc+Vx1kvBXUd5RDpmyeBJF
yyiajpcDpst8Q5bF0WrAvPSKUHFNh4fmesBCTVlcMWUyqfEsJ0LFdVY+y6NAPAG3mE9GsygaMLEX
XthujepFF7XNE4CJ0R6pqfuo5K371/2XCMDMtpRAZli42TSB5ng3qNtJ6lpvjVLmAE438NcNf2Ur
fnFFnM211FlfDFwrbvyOkEEcK3RmJt2/2vJaWLVbheF0fi3TAHIogaX046G1jgjsoBFTVc99TSw3
LrGy8NLoHpl75Q6csZnQ8rfoiYO7A6XWmo8fsnaD+3sG9lq+G7+KF1buRXIM6bGUkNwj432ZHQCQ
/liE6fweJhL5l57WIs3DVG6FcnQ6aySLf1b1XGIsF9FiOseY3xyim1LeiCVPKcemQTERQnOTGGWg
DYzS8MPTlLaiVP4cz6+67XxwMAVpGCiTPMOyiRdy4ZzMNMFAl0q93DucAM65VHiXGH15fpHWeAHR
tgR2uhbYj01G48VwNMf/22gVR/N4PPuB/coivWozHsWTaTxbBptEGddimig2Jj0CGd5jDyldevzJ
PoUjtOYbmNxFEer9Vn/vongXRXwb8P9DFE9/AIxEil7HCgAA
headers:
Access-Control-Allow-Origin: ['*']
Access-Control-Expose-Headers: ['ETag, Link, 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, 06 Jun 2017 10:25:17 GMT']
ETag: [W/"35a947c9bd13c5b250eacf4b4e4b14be"]
Server: [GitHub.com]
Status: [200 OK]
Strict-Transport-Security: [max-age=31536000; includeSubdomains; preload]
Vary: ['Accept, Authorization, Cookie, X-GitHub-OTP', Accept-Encoding]
X-Accepted-OAuth-Scopes: ['public_repo, repo']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['E8EE:13F60:35E4DC8:46819F5:5936830B']
X-OAuth-Scopes: ['admin:gpg_key, admin:org, admin:org_hook, admin:public_key,
admin:repo_hook, delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4890']
X-RateLimit-Reset: ['1496745470']
X-Runtime-rack: ['0.093453']
X-Served-By: [593010132f82159af0ded24b4932e109]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
import unittest
import os
import datetime
import vcr
from IGitt.GitHub.GitHubIssue import GitHubIssue
my_vcr = vcr.VCR(match_on=['method', 'scheme', 'host', 'port', 'path'],
filter_query_parameters=['access_token'],
filter_post_data_parameters=['access_token'])
class GitHubIssueTest(unittest.TestCase):
@my_vcr.use_cassette('tests/GitHub/cassettes/github_issue.yaml',
filter_query_parameters=['access_token'])
def setUp(self):
self.iss = GitHubIssue(os.environ.get('GITHUB_TEST_TOKEN', ''),
'gitmate-test-user/test', 39)
@my_vcr.use_cassette('tests/GitHub/cassettes/github_issue_title.yaml',
filter_query_parameters=['access_token'])
def test_title(self):
self.assertEqual(self.iss.title, 'new title')
self.iss.title = 'new title'
self.assertEqual(self.iss.title, 'new title')
def test_assignee(self):
self.assertEqual(self.iss.assignee, None)
def test_number(self):
self.assertEqual(self.iss.number, 39)
def test_description(self):
self.assertEqual(self.iss.description, 'test description\r\n')
@my_vcr.use_cassette('tests/GitHub/cassettes/github_issue_comment.yaml',
filter_query_parameters=['access_token'])
def test_comment(self):
self.iss.add_comment('this is a comment')
self.assertEqual(self.iss.comments[0].body, 'this is a comment')
@my_vcr.use_cassette('tests/GitHub/cassettes/github_issue_labels.yaml',
filter_query_parameters=['access_token'])
def test_issue_labels(self):
self.assertEqual(list(self.iss.labels), ['dem'])
self.iss.labels = self.iss.labels | {'dem'}
self.assertEqual(len(self.iss.available_labels), 4)
@my_vcr.use_cassette('tests/GitHub/cassettes/github_issue_time.yaml',
filter_query_parameters=['access_token'])
def test_time(self):
self.assertEqual(self.iss.created,
datetime.datetime(2017, 6, 6, 9, 36, 15))
self.assertEqual(self.iss.updated,
datetime.datetime(2017, 6, 6, 10, 20, 49))
@my_vcr.use_cassette('tests/GitHub/cassettes/github_issue_state.yaml',
filter_query_parameters=['access_token'])
def test_state(self):
self.iss.close()
self.assertEqual(self.iss.state, 'closed')
self.iss.reopen()
self.assertEqual(self.iss.state, 'open')
@my_vcr.use_cassette('tests/GitHub/cassettes/github_issue_create.yaml',
filter_query_parameters=['access_token'])
def test_issue_create(self):
iss = GitHubIssue.create(os.environ.get('GITHUB_TEST_TOKEN', ''),
'gitmate-test-user/test',
'test title', 'test body')
self.assertEqual(iss.state, 'open')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment