<commit_before>'use strict';

var test = require('tape'); //jshint ignore:line
var Github = require("../");
var test_user = require('./user.json');

test("Repo API", function(t) {
    var timeout = setTimeout(function () { t.fail(); }, 100000);
    var github = new Github({
      username: test_user.USERNAME,
      password: <PASSWORD>,
      auth: "basic"
    });
    var repo = github.getRepo('michael', 'github');

    t.test('repo.show', function(q) {
        repo.show(function(err, res) {
            q.error(err, 'show repo');
            q.equals(res.full_name, 'michael/github', 'repo name');
            q.end();
        });
    });

    t.test('repo.contents', function(q) {
        repo.contents('master', './', function(err) {
            q.error(err, 'get repo contents');
            q.end();
        });
    });

    t.test('repo.fork', function(q) {
        repo.fork(function(err) {
            q.error(err, 'test fork repo');
            q.end();
        });
    });

    t.test('repo.contributors', function(q) {
      repo.contributors(function(err, res) {
        q.error(err, 'repo contributors');
        q.ok(res instanceof Array, 'list of contributors');
        q.ok(res.length, 'at least one contributor');
        q.ok(res[0].author, 'contributor info');
        q.ok(res[0].total, 'total number of commits');
        q.ok(res[0].weeks, 'weekly hash');
        q.end();
      });
    });

    //@TODO repo.branch, repo.pull

    t.test('repo.listBranches', function(q) {
        repo.listBranches(function(err) {
            q.error(err, 'list branches');
            q.end();
        });
    });

    t.test('repo.read', function(q) {
        repo.read('master', 'README.md', function(err, res) {
            q.notEquals(res.indexOf('# Github.js'), -1, 'Returned README');
            q.end();
        });
    });

    t.test('repo.getCommit', function(q) {
        repo.getCommit('master', '20fcff9129005d14cc97b9d59b8a3d37f4fb633b', function(err, commit) {
            q.error(err, 'get commit' + err);
            q.equals(commit.message, 'v0.10.4', 'Returned commit message.');
            q.equals(commit.author.date, '2015-03-20T17:01:42Z', 'Got correct date.');
            q.end();
        });
    });

    t.test('repo.getSha', function(q) {
        repo.getSha('master', '.gitignore', function(err, sha) {
            q.error(err, 'get sha error: ' + err);
            q.equals(sha, '153216eb946aedc51f4fe88a51008b4abcac5308', 'Returned sha message.');
            q.end();
        });
    });

    t.test('getRepo(fullname)', function(q) {
        var repo2 = github.getRepo('michael/github');
        repo2.show(function(err, res) {
            q.error(err, 'show repo');
            q.equals(res.full_name, 'michael/github', 'repo name');
            q.end();
        });
    });

    clearTimeout(timeout);
    t.end();

});

var repoTest = Date.now();

test('Create Repo', function(t) {
  var timeout = setTimeout(function () { t.fail(); }, 10000);
  var github = new Github({
    username: test_user.USERNAME,
    password: <PASSWORD>,
    auth: "basic"
  });
  var user = github.getUser();
<commit_msg>Test: Fixed test for repo.getSha<commit_after>'use strict';

var test = require('tape'); //jshint ignore:line
var Github = require("../");
var test_user = require('./user.json');

test("Repo API", function(t) {
    var timeout = setTimeout(function () { t.fail(); }, 100000);
    var github = new Github({
      username: test_user.USERNAME,
      password: <PASSWORD>,
      auth: "basic"
    });
    var repo = github.getRepo('michael', 'github');

    t.test('repo.show', function(q) {
        repo.show(function(err, res) {
            q.error(err, 'show repo');
            q.equals(res.full_name, 'michael/github', 'repo name');
            q.end();
        });
    });

    t.test('repo.contents', function(q) {
        repo.contents('master', './', function(err) {
            q.error(err, 'get repo contents');
            q.end();
        });
    });

    t.test('repo.fork', function(q) {
        repo.fork(function(err) {
            q.error(err, 'test fork repo');
            q.end();
        });
    });

    t.test('repo.contributors', function(q) {
      repo.contributors(function(err, res) {
        q.error(err, 'repo contributors');
        q.ok(res instanceof Array, 'list of contributors');
        q.ok(res.length, 'at least one contributor');
        q.ok(res[0].author, 'contributor info');
        q.ok(res[0].total, 'total number of commits');
        q.ok(res[0].weeks, 'weekly hash');
        q.end();
      });
    });

    //@TODO repo.branch, repo.pull

    t.test('repo.listBranches', function(q) {
        repo.listBranches(function(err) {
            q.error(err, 'list branches');
            q.end();
        });
    });

    t.test('repo.read', function(q) {
        repo.read('master', 'README.md', function(err, res) {
            q.notEquals(res.indexOf('# Github.js'), -1, 'Returned README');
            q.end();
        });
    });

    t.test('repo.getCommit', function(q) {
        repo.getCommit('master', '20fcff9129005d14cc97b9d59b8a3d37f4fb633b', function(err, commit) {
            q.error(err, 'get commit' + err);
            q.equals(commit.message, 'v0.10.4', 'Returned commit message.');
            q.equals(commit.author.date, '2015-03-20T17:01:42Z', 'Got correct date.');
            q.end();
        });
    });

    t.test('repo.getSha', function(q) {
        repo.getSha('master', '.gitignore', function(err, sha) {
            q.error(err, 'get sha error: ' + err);
            q.equals(sha, '8293a5658aed839ed52fb0e5bd9e6c467c992d3d', 'Returned sha message.');
            q.end();
        });
    });

    t.test('getRepo(fullname)', function(q) {
        var repo2 = github.getRepo('michael/github');
        repo2.show(function(err, res) {
            q.error(err, 'show repo');
            q.equals(res.full_name, 'michael/github', 'repo name');
            q.end();
        });
    });

    clearTimeout(timeout);
    t.end();

});

var repoTest = Date.now();

test('Create Repo', function(t) {
  var timeout = setTimeout(function () { t.fail(); }, 10000);
  var github = new Github({
    username: test_user.USERNAME,
    password: <PASSWORD>,
    auth: "basic"
  });
  var user = github.getUser();

{'fraction_non_alphanumeric': 0.18573010599588674, 'fraction_numerical': 0.026261667457680746, 'mean_word_length': 2.255406797116375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1602387', 'n_tokens_mistral': 2213, 'n_tokens_neox': 2102, 'n_words': 394}