X-Git-Url: http://git.roojs.org/?p=gitlive;a=blobdiff_plain;f=tests%2Ftickets.js;h=5577311f893d3bb73b5282b76aab29be4a66f112;hp=cf70330ce8aae5776e687dd9af2d64a52e3b1e59;hb=01e7beaf18d9aca3c2c2ad6f60c4b183aa177888;hpb=3fedce66e452b4eca5c22946304636492f1eff69 diff --git a/tests/tickets.js b/tests/tickets.js index cf70330c..5577311f 100644 --- a/tests/tickets.js +++ b/tests/tickets.js @@ -3,8 +3,14 @@ * let's see if we can pull a list of tickets from the tracker.. * */ + +GI = imports.gi.GIRepository GLib = imports.gi.GLib; +// we add this in, as it appears to get lost sometimes if we set it using the ENV. variable in builder.sh +GI.IRepository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.1'); + +Soup = imports.gi.Soup ; File = imports['../File.js'].File; @@ -29,19 +35,28 @@ Tickets = { }, - fetchBugs : function() + fetchBugs : function(url) { + Tickets.parseNetrc(); + var ar = url.split('/'); + print(JSON.stringify(ar, null, 4)); + var auth = new Soup.Auth() var session = new Soup.SessionSync(); - - var status = session.send_message( - new Soup.Message({ + session.signal.authenticate.connect(function(sess, msg, auth, rt) { + //print("authenticate?"); + auth.authenticate( + Tickets.machines[ar[2]].login, + Tickets.machines[ar[2]].password + ); + }); + var request = new Soup.Message({ method:"GET", - uri:new Soup.URI.c_new("http://roojs.com/mtrack.php/Bugs") - }) - ); + uri:new Soup.URI.c_new(url) + }); + var status = session.send_message(request); var data = request.response_body.data; - print(data); + return JSON.parse(data).data; } @@ -49,6 +64,11 @@ Tickets = { } -Tickets.parseNetrc(); -print ( JSON.stringify(Tickets.machines) ); +//print ( JSON.stringify(Tickets.machines) ); + + + + +//Tickets.fetchBugs("http://www.roojs.com/mtrack/index.php/Gitlive/web.hex"); + \ No newline at end of file