Permalink
Browse files

Syntax error

  • Loading branch information...
Daniel Park
Daniel Park committed Oct 5, 2012
1 parent c305065 commit a662667afa2975d38968502bcf34289a22b42009
Showing with 0 additions and 100 deletions.
  1. +0 −100 openid/openid.verify.test.xml
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
- <meta>
- <author>Erik Eldridge</author>
- <description>Unit tests for openid normalization</description>
- <sampleQuery>select * from {table}</sampleQuery>
- </meta>
- <bindings>
- <select produces="JSON">
- <inputs></inputs>
- <execute><![CDATA[
-
- //credit: http://javascript.crockford.com/remedial.html
- if(!String.prototype.supplant){String.prototype.supplant=function(o){return this.replace(/{([^{}]*)}/g,function(a,b){var r=o[b];return typeof r==='string'||typeof r==='number'?r:a;});};}if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");};}
-
- var tableUri = 'http://github.com/erikeldridge/yql-tables/raw/master/openid/openid.verify.xml';
- var validAssocJson = '{"mac_key":"vN5O9I0A7Fxr1192Amq7KGK4UZA=","ns":"http","assoc_handle":"Ouk8a7L.fB0EafenhPselqapymq.r8640Jv0.H8WSdpn8SzKb3uj_cDb4GIIgqB4WuXD1XgYvkgkAagNd3pl.oY6Iqcw4bMJAwkTVeUGCFcsV1XLgqzoJ73_ff4yQ0k-","session_type":"no-encryption","expires_in":"14400","assoc_type":"HMAC-SHA1"}';
- var validAssertJson = '{"openid.ns":"http://specs.openid.net/auth/2.0","openid.mode":"id_res","openid.return_to":"http://test.erikeldridge.com/yql/openid/example.verify.html","openid.claimed_id":"https://me.yahoo.com/pandayak#415d4","openid.identity":"https://me.yahoo.com/pandayak","openid.assoc_handle":"Ouk8a7L.fB0EafenhPselqapymq.r8640Jv0.H8WSdpn8SzKb3uj_cDb4GIIgqB4WuXD1XgYvkgkAagNd3pl.oY6Iqcw4bMJAwkTVeUGCFcsV1XLgqzoJ73_ff4yQ0k-","openid.realm":"http://test.erikeldridge.com","openid.ns.oauth":"http://specs.openid.net/extensions/oauth/1.0","domain_unverified":"1","openid.response_nonce":"2010-04-02T05:00:20ZkGjAgp1R4lWRkAShqjBw1mhB0qwtQXVVQw--","openid.signed":"assoc_handle,claimed_id,identity,mode,ns,op_endpoint,response_nonce,return_to,signed,pape.auth_level.nist,ns.oauth,oauth.request_token","openid.op_endpoint":"https://open.login.yahooapis.com/openid/op/auth","openid.pape.auth_level.nist":"0","openid.oauth.request_token":"YhHa7LVu3AaRg4JNuo_XtLmKxPOxVkjt.hHsKeGol6uFZ_6lLfauZ5cHXiN4L9pxkg3AyXuMBHj0XHcB729G6Cjf8.xnnCH7iDRK8jBPTq5LQ8bna1P23jek.7nzy7evNVum9.ps80Q78DZN4MsHPXZ5bjGW2DUUAX9u0yvmBBRAEfRDfx2gIP6d8gFkX4qwdQlWa20bSZxxaSp4i3U-","openid.sig":"naLpyZxZfA/g3mJxzgDLduYtC+A="}';
- //cases
- /*
- - valid input
- - correct error responses for invalid, required fields
- -- assertJson
- --- invalid json
- -- localurl
- --- invalid uri
- --- missing fields
- - invalid optional fields
- -- assocJson
- --- invalid json
- --- missing fields
- -- nonceStoreUri
- --- invalid uri
- -
- */
- testCases = [
- function(){
- var output = {
- 'case': 'valid assertJson, localurl, & assocJson'
- };
-
- var query = "use '{tableUri}' as table; select * from table where localUrl='{localUrl}' and assertJson='{assertJson}' and assocJson='{assocJson}'".supplant({
- tableUri: tableUri,
- localUrl: 'http://test.erikeldridge.com/yql/openid/example.verify.html',
- assocJson: validAssocJson,
- assertJson: validAssertJson
- });
- var results = y.query( query ).results;
-
- //tests
- if ( results.error ) {
- output['fail'] = "we should be all good, but we're getting error: "+results.error;
- return output;
- }
-
- if ( ':)' != results.success ) {
- output['fail'] = 'we should be getting smiley face, not: '+results.success;
- return output;
- }
-
- //pass if no tests fail
- output['pass'] = ''
- return output;
- }(),
- function(){
- var output = {
- 'case': 'invalid assertJson, valid localurl & assocJson'
- };
-
- var query = "use '{tableUri}' as table; select * from table where localUrl='{localUrl}' and assertJson='{assertJson}' and assocJson='{assocJson}'".supplant({
- tableUri: tableUri,
- localUrl: 'example.com',
- assocJson: validAssocJson,
- assertJson: validAssertJson.substr(0, 100)
- });
- var results = y.query( query ).results;
-
- //tests
- if ( results.success ) {
- output['fail'] = 'we shouldn\'t get success response w/ invalid json';
- return output;
- }
-
- if ( -1 === results.error.indexOf( 'invalid assertJson' ) ) {
- output['fail'] = 'we should be getting an invalid localUrl syntax error';
- return output;
- }
-
- //pass if no tests fail
- output['pass'] = ''
- return output;
- }()
- ];
-
- response.object = { cases: testCases };
-
- ]]></execute>
- </select>
- </bindings>
-</table>

0 comments on commit a662667

Please sign in to comment.