Commit 20f3e30a authored by Meet Mangukiya's avatar Meet Mangukiya

test_github_hoster: Add tests for GitHub

Adds to #34
parent 04e4f082
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
response:
body:
string: !!binary |
H4sIAAAAAAAAA6WYwXLjKBCGX2VK17WNNFl7sqramn2I2cteXFjCEhtJaAHZlajy7vs3SJbsScme
cEkpmP74gW7opo9kHqW//7HdPn/bJquo4bWI0sgKY6NVdOyqaj80FdLW3Io1/bTujNBs6KTOjdBR
2keVKmQD4596gkSjJLvdcxI/xauIn7jlet/pCt1La1uTMuYbTbyBfdkdaIhMNVY0dpOpmnVstP9+
+vMJyEIPGGJHaLjBtXIgeXPgDPtIWmnr6kaKV+DsPrI4qqpSZ/BuZ/DQkOxiTivsULIpQlAw75my
pcCSYprvtDjS2E/Kc6Y9Jm7sXuYEM9gsLfLPSRyMIZD85L1nWrTKUbuDybRsrVTNJ6VeIYBUuuCN
fOMBSCAMSCTyk6KcKRDiBNf9JMPb9qzV8sSzV1ouLTIhT9iFEO4NBFj72lLA/w2/oT2RVux5XlMc
H3llxPsqchosOrmGFeL1l+JlPCZycdltjMe/0OnxhdYKwx6VfrnwF8PYLe7PQTkOQqA7S75EQGjC
HoJexGsIhsx7hr9DAGWIcn5Qmlt179BYlHfF6dn8X3IRK3gdItvZg1MqFbSKzh4caUwnHvLXxVk7
jGFjTDRdffCH3CORsEj2ACjlxsiiESJk9S6Mno2n8EHzJiuDqCOiZ/7L7TMvQoSSOSiHSh1CMLgZ
mWP0zJTcXzp2H6iNoIS4YmpxDBVKiAvT6rCddiKJcSHikrPY9BCVI4L1w2pWvCk6XgRBLwzsN13E
BX+7m7YsRswEAZHSMy0PXfCpNmFIp88LEONByzlRJqbLNZbTmOXZz1IWN/+6lveu+EXgQLjy9nAq
+ectmf6/n4/cFUuInk1HsD/iB3jAyg5n/KhyPsRQBIQ4w4hg/W8ttyWdVRip5VoESB4IrD9w5Emb
zaYvBXf5ci10WNh6AEhcZyWSvgCV/YhAaoP6zeXfRxKZIx+vFM9D1vXCAM/vYIBSD5jvfIvyM0Se
s58Da1kh61RN0Jk6QeboRll5lNkjpcdikF1x+u9GNplY8apawVutzCT8F+UebSAyShG0PB6ASaDm
9xVGJeDKISuuhUf0zFeOuWgr9Rp68MwoFLlaoBzJ99yijvgaJ7t1nKyTpx/xt3S7S5PtP+jTtfnd
Pm1nyitMkqzj5x9JnMZx+vSVMDhIB4fGF54olt4FXAlCLw6wM6ac7P6arFJ8fvCIMlhlFTzzJoAe
HvF0e6/dtYTOUtWiRYoRpQ1Chcq/N3zjGWiWK2Sqa7DSeLU5c4tkFrfy1DTmFyOg5Gbv4zhKre6o
WkRLq9W/IrNm3jYdHbOOZ/kirwwp/bkUhr64GwaHyFpqrYZXJK9ftaIZxh9Fbne+vAQGJrMOEbxl
mpObYC6OvKvs3mfa8K6aG+vq4lboGvOilwp66RoqZD9D8qNRNJ04/huFM6JWnffmv47DHdyRPnbz
v7gm6KQk4voXLehOubZphD2jOh3nRZs0S5TGLXn/HwHBdofREwAA
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: ['Wed, 07 Jun 2017 08:57:10 GMT']
ETag: [W/"97f134d0705aa8f739fbfb77b36edca4"]
Last-Modified: ['Wed, 13 Jan 2016 07:56:15 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: [repo]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['865E:13F61:7A50F73:9FFB4BD:5937BFE5']
X-OAuth-Scopes: ['admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4797']
X-RateLimit-Reset: ['1496826754']
X-Runtime-rack: ['0.041838']
X-Served-By: [02ea60dfed58b2a09106fafd6ca0c108]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
interactions:
- request:
body: null
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Connection: [keep-alive]
User-Agent: [GitMate]
method: GET
uri: https://api.github.com/user/repos
response:
body:
string: !!binary |
H4sIAAAAAAAAA72aX2+rNhTAv0rF06YlBZImaZGmu4+wh+5l0xQ5xAneBYxs06oX9bvvHNsEEqck
wdlerijx+fn4L/ZP968mYNsgeXpZLJ5Xi3gSlKSgQRIoKlUwCXZ1nq/tqz1TBVF0ij9Na0lFaAvx
95KKIGmCnO9ZCcFOSSBhLfFy+RxH82gSkDeiiFjXIofimVKVTMLQvJTRI8Rn9QarSHmpaKkeU16E
ddjGf3v7dQ7IvbAYZAfw4gRXMUsy4YCT4bnUMlXkJ6mYDHTcuYgdz3P+DrzTFlxVZXgIxx7WKFbu
fVAQ3oRcZRS6FJr5iZ3DpBqZng5toOFSrdkWYRIGS9DtuBRtMCSI8+SzCQWtuKbWG5kKVinGy5Gp
HiEAycWelOwH8UACQgIJkxyZlA4FBH2DqTuSYWKbsBLsjaQf2F2CppS9wSj4cE8ggFUfFS74P2De
4JgwRddkW+A63pFc0s9JoHNQUEi/mMB6vWm9tNvElh5GG+ojD7h7PGBfQbU7Lr4f+IPLWHeuuyjb
ShB0ocuHCLA0IR4S+k4/fDAY3oTwr11AKaxysuGCKH5p0xhM74jThP0/cYooSgqftHU8cDLOvXpR
x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rb5+q/Wms5wTcb
LZfgLbNc5L08lku+WWG5iLH2yiXdQVy50HHOyuV46ioX6GOqXNqtksolwDr08FPneaPV1HncOCt1
njVeSLk8Pxfl8sZrKJflZaBcXN9hwW59o3xyeT1Ah7vaO33J0wQA3iCHXNapE4IVAsfkqx2WC8Ql
dgptFc41JsAlttFejsnF3kkvuWA/s3SOp7WUl1RyqWN8kku5j0pyueMsksvxEEguzNMducA7aSMX
/F8YI7cWH1nk0jw9kQscVkSLKbidePUaz5NolsyX5xTRahotptHLaxwns2Uyf8EyJ4pIF5k9vcar
JH5K5vMLisjJ8pId+irgghj6KkwOOSEnCJp7XgfNxuig4PcPlekv1v+nhCDRq5RQZ4Qg4sgI+Qoh
+z8kvjJCf/8LZleIHm8lAAA=
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: ['Thu, 08 Jun 2017 20:40:42 GMT']
ETag: [W/"981aaeb3e9d5c97e6b0cd51c1b8c8787"]
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: ['']
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['A798:1B589:29C86B:35D448:5939B649']
X-OAuth-Scopes: ['admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4873']
X-RateLimit-Reset: ['1496955894']
X-Runtime-rack: ['0.063703']
X-Served-By: [62cdcc2d03a2f173f1c58590d1a90077]
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
response:
body:
string: !!binary |
H4sIAAAAAAAAA6WY3XKjOBCFX2WK27UjmKyTLFVTsw8xe7M3Lhlk0AYQIwm7EirvvqclMNiTwh7r
JkVk9aejn251q49kHqV//rXZvDxvklXU8FpEaWSFsdEq2ndVtR2aCmlrbsWaflp3Rmg2dFLHRugo
7aNKFbKB8S89QaJRkqenlyR+jFcRP3DL9bbTFbqX1rYmZcw3mvgB9mW3oyEy1VjR2IdM1axjo/33
w7dHIAs9YIgdoeEC18qB5M2BM+wzaaWtqwspXoGz+8xir6pKHcG7nMFNQ7KTOa2wQ8mmCEHBvGfK
lgJLiml+0OJIY++U50x7TNzYrcwJZrBZWuT3SRyMIZDOyUfPtGiVo3Y7k2nZWqmaO6WeIYBUuuCN
fOcBSCAMSCTyTlHOFAhxwNG9k+Fte9ZqeeDZGy2XFpmQB+xCCPcCAqx9a8nh/8G5oT2RVmx5XpMf
73llxMcqchosOrmGFfz1t/xlDBO5OO02xuNfKHp8obXCsHulX0/8RTd2i/urU46DEOjKki8R4Jqw
h6BX8RaCIfOe4e/gQBm8nO+U5lZdCxqL8s44PZv/S0fECl6HyHb24JRKBa2iswdHGtOJm87r4qwd
xrDRJ5qu3vkgd4snLJI9AEq5MbJohAhZvROjZ2MU3mneZGUQdUT0zH+5feZFiFAyB2VXqV0IBjcj
c4yemZL7S8duA7URlBBnTC32oUIJcWJaHbbTTiQxTkRcchabHqJyRLB+WM2KN0XHiyDoiYH9pou4
4O9X05ZFj5kgIFJ6puWuC45qE4Z0+rwAPh60nBNlYrpcYzmNWZ79LGVx869ree2KXwQOhLPTHk6l
83lJpv+v5yNXxRKiZ1MI9iF+gAes7BDjR5XzIYYiIOQwjAjW/9FyW1Kswkgt1yJA8kBg/Y4jT3p4
eOhLwV2+XAsd5rYeABLXWYmkL0BlPyKQ2qB+c/n3nkTmyMcrxfOQdT0xwPM7GKDUA+Y736L8DJHn
7OfAWlbIOlUTFFMnyBzdKCv3Mrul9Fh0sjNO/93IJhMrXlUrnFYrM4nzi3KPNhAZpQhaHg/AJFDz
+wqjEjjKISuuhUf0zFeOuWgr9RYaeGYU8lwtUI7kW25RR3yNk6d1nKyTxx/xc7p5SpPNv+jTtfnV
Pm1nyjNMkqzjlx9JnMZx+viVMAikw4HGF54olt4FXAlCLw6wM6ac7P6erFJ8fvKIMlhlFU7mhQPd
POLh8l67agmdpapFixQjShu4CpV/7/jGM9AsV8hU12Cl8Wpz5BbJLG7lqWnML0ZAyc3W+3GUWt1R
tYiWVqv/RGbNvG0KHbOOR/kqzwwp/TkVhr64GwaHyFpqrYZXJK9ftaIZxh9FPr/48hIYmMw6RCn9
NM7JTTAXe95VduszbZyumhvr6uJW6BrzopcKeukaKmQ/QzpHo2iKOP4bhTO8Vh235mfHcRxcSB+7
+V9cE3RSEnH+ixZ0p5zbNMIeUZ2O86JNmiVK45Z8/A/cYXRP0RMAAA==
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: ['Thu, 08 Jun 2017 20:40:43 GMT']
ETag: [W/"465506ccf01d92126f4c9aa9c4ff6447"]
Last-Modified: ['Wed, 13 Jan 2016 07:56:15 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: [repo]
X-Content-Type-Options: [nosniff]
X-Frame-Options: [deny]
X-GitHub-Media-Type: [github.v3; format=json]
X-GitHub-Request-Id: ['A79A:1B58B:DBA045:11E7125:5939B64A']
X-OAuth-Scopes: ['admin:org, admin:org_hook, admin:public_key, admin:repo_hook,
delete_repo, gist, notifications, repo, user']
X-RateLimit-Limit: ['5000']
X-RateLimit-Remaining: ['4872']
X-RateLimit-Reset: ['1496955894']
X-Runtime-rack: ['0.068776']
X-Served-By: [77fbfb53269bbb85f82f23584d59f7c1]
X-XSS-Protection: [1; mode=block]
status: {code: 200, message: OK}
version: 1
This diff is collapsed.
import os
import unittest
import vcr
from IGitt.GitHub.GitHub import GitHub
my_vcr = vcr.VCR(match_on=['method', 'scheme', 'host', 'port', 'path'],
filter_query_parameters=['access_token'],
filter_post_data_parameters=['access_token'])
class TestGitHub(unittest.TestCase):
@my_vcr.use_cassette('tests/GitHub/cassettes/test_github_hoster.yaml')
def setUp(self):
self.gh = GitHub(os.environ.get('GITHUB_TEST_TOKEN', ''))
@my_vcr.use_cassette('tests/GitHub/cassettes/test_github_hoster_owned.yaml')
def test_owned_repositories(self):
self.assertEqual(sorted(map(lambda x: x.full_name, self.gh.owned_repositories)),
['gitmate-test-user/test'])
@my_vcr.use_cassette('tests/GitHub/cassettes/test_github_hoster_write.yaml')
def test_write_repositories(self):
self.assertEqual(sorted(map(lambda x: x.full_name, self.gh.write_repositories)),
['gitmate-test-user/test', 'sils/gitmate-test'])
@my_vcr.use_cassette('tests/GitHub/cassettes/test_github_hoster_get_repo.yaml')
def test_get_repo(self):
self.assertEqual(self.gh.get_repo('gitmate-test-user/test').full_name,
'gitmate-test-user/test')
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