File tree Expand file tree Collapse file tree 7 files changed +109
-7
lines changed
Expand file tree Collapse file tree 7 files changed +109
-7
lines changed Original file line number Diff line number Diff line change 11_site /*
22.DS_Store
33
4- test /.DS_Store
4+ test /.DS_Store
5+ node_modules /
Original file line number Diff line number Diff line change 99 // Initial Setup
1010 // -------------
1111
12- var XMLHttpRequest ;
13- if ( typeof this . exports !== 'undefined' ) {
14- XMLHttpRequest = require ( 'xmlhttprequest' ) . XMLHttpRequest ;
15- var _ = require ( 'underscore' ) ;
12+ var XMLHttpRequest , Base64 , _ ;
13+ if ( typeof exports !== 'undefined' ) {
14+ XMLHttpRequest = require ( 'xmlhttprequest' ) . XMLHttpRequest ;
15+ _ = require ( 'underscore' ) ;
16+ Base64 = require ( './lib/base64.js' ) ;
1617 } else {
17- XMLHttpRequest = window . XMLHttpRequest ;
18+ XMLHttpRequest = window . XMLHttpRequest ;
19+ _ = window . _ ;
20+ Base64 = window . Base64 ;
1821 }
22+
1923
2024 var API_URL = 'https://api.github.com' ;
2125
Original file line number Diff line number Diff line change @@ -78,5 +78,10 @@ var Base64 = (function () {
7878
7979 return obj ;
8080} ) ( ) ;
81+ if ( typeof exports !== 'undefined' ) {
82+ // Github = exports;
83+ module . exports = Base64 ;
84+ } else {
85+ window . Base64 = Base64 ;
86+ }
8187
82- window . Base64 = Base64
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " github" ,
3+ "version" : " 0.7.0" ,
4+ "description" : " A higher-level wrapper around the Github API." ,
5+ "main" : " github.js" ,
6+ "dependencies" : {
7+ "xmlhttprequest" : " *" ,
8+ "underscore" : " *"
9+ },
10+ "devDependencies" : {
11+ "mocha" : " *" ,
12+ "chai" : " *"
13+ },
14+ "scripts" : {
15+ "test" : " mocha"
16+
17+ },
18+ "repository" : {
19+ "type" : " git" ,
20+ "url" : " git://github.com/darvin/github.git"
21+ },
22+ "keywords" : [
23+ " github" ,
24+ " api"
25+ ],
26+ "author" : " Sergey Klimov <sergey.v.klimov@gmail.com> (http://darvin.github.com/)" ,
27+ "license" : " BSD" ,
28+ "readmeFilename" : " README.md" ,
29+ "gitHead" : " aa8aa3c8cd5ce5240373d4fd1d06a7ab4af41a36" ,
30+ "bugs" : {
31+ "url" : " https://github.com/darvin/github/issues"
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ if ( typeof require !== 'undefined' ) {
2+ var Github = require ( "../" )
3+ , chai = require ( "chai" ) ;
4+ }
5+ chai . should ( ) ;
6+ var expect = chai . expect
7+ , TEST_USERNAME = "mikedeboertest"
8+ , TEST_PASSWORD = "test1324" ;
9+
10+ // var util = require("util");
11+
12+ describe ( "Auth" , function ( ) {
13+ this . timeout ( 10000 ) ;
14+ it ( "should authenticate with basic auth" , function ( done ) {
15+ var github = new Github ( {
16+ username : TEST_USERNAME ,
17+ password : TEST_PASSWORD ,
18+ auth : "basic"
19+ } ) ;
20+ var user = github . getUser ( ) ;
21+ user . repos ( function ( err , repos ) {
22+ // console.error(util.inspect(err));
23+ expect ( err ) . to . be . null ;
24+ repos . should . be . ok ;
25+ repos . length . should . be . above ( 1 ) ;
26+ done ( ) ;
27+
28+ } ) ;
29+
30+ } ) ;
31+ } ) ;
Original file line number Diff line number Diff line change 1+ < html >
2+ < head >
3+ < meta charset ="utf-8 ">
4+ < title > Mocha Tests</ title >
5+ < link rel ="stylesheet " href ="../node_modules/mocha/mocha.css " />
6+ </ head >
7+ < body >
8+ < div id ="mocha "> </ div >
9+ < script src ="../lib/base64.js "> </ script >
10+ < script src ="../lib/underscore-min.js "> </ script >
11+ < script src ="../github.js "> </ script >
12+ < script src ="../node_modules/mocha/mocha.js "> </ script >
13+ < script src ="../node_modules/chai/chai.js "> </ script >
14+ < script > mocha . setup ( 'bdd' ) </ script >
15+ < script src ="auth_test.js "> </ script >
16+ < script >
17+ mocha . checkLeaks ( ) ;
18+ mocha . globals ( [ '_' , 'Github' ] ) ;
19+ mocha . run ( ) ;
20+ </ script >
21+ </ body >
22+ </ html >
Original file line number Diff line number Diff line change 1+ language : node_js
2+ node_js :
3+ - " 0.11"
4+ - " 0.10"
5+ - " 0.8"
6+ - " 0.6"
You can’t perform that action at this time.
0 commit comments