|
| 1 | +var test = require('tape'); |
| 2 | +var Github = require("../"); |
| 3 | +var test_user = require('./user.json'); |
| 4 | + |
| 5 | +test("Repo API", function(t) { |
| 6 | + var timeout = setTimeout(function () { t.fail(); }, 100000); |
| 7 | + var github = new Github({ |
| 8 | + username: test_user.USERNAME, |
| 9 | + password: test_user.PASSWORD, |
| 10 | + auth: "basic" |
| 11 | + }); |
| 12 | + var repo = github.getRepo('michael', 'github'); |
| 13 | + |
| 14 | + t.test('repo.show', function(q) { |
| 15 | + repo.show(function(err, res) { |
| 16 | + q.error(err, 'show repo'); |
| 17 | + q.equals(res.full_name, 'michael/github', 'repo name'); |
| 18 | + q.end(); |
| 19 | + }); |
| 20 | + }); |
| 21 | + |
| 22 | + t.test('repo.contents', function(q) { |
| 23 | + repo.contents('master', './', function(err, res) { |
| 24 | + q.error(err, 'get repo contents'); |
| 25 | + q.end(); |
| 26 | + }); |
| 27 | + }); |
| 28 | + |
| 29 | + t.test('repo.fork', function(q) { |
| 30 | + repo.fork(function(err, res) { |
| 31 | + q.error(err, 'test fork repo'); |
| 32 | + q.end(); |
| 33 | + }); |
| 34 | + }); |
| 35 | + |
| 36 | + //@TODO repo.branch, repo.pull |
| 37 | + |
| 38 | + t.test('repo.listBranches', function(q) { |
| 39 | + repo.listBranches(function(err, res) { |
| 40 | + q.error(err, 'list branches'); |
| 41 | + q.end(); |
| 42 | + }); |
| 43 | + }); |
| 44 | + |
| 45 | + clearTimeout(timeout); |
| 46 | + t.end(); |
| 47 | + |
| 48 | +}); |
0 commit comments