Skip to content

Commit

Permalink
Remove check for api_key in arguments
Browse files Browse the repository at this point in the history
Oh no big deal just deleting 206 tests
  • Loading branch information
jeremyruppel committed Oct 26, 2016
1 parent a029b89 commit 4dcb33e
Show file tree
Hide file tree
Showing 208 changed files with 448 additions and 2,583 deletions.
3 changes: 0 additions & 3 deletions request.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ module.exports = function createClient(defaults) {
if (typeof args === 'undefined') {
args = {};
}
if (!defaults.api_key && !args.api_key) {
throw new Error('Missing required argument "api_key"');
}

return request(verb, 'https://api.flickr.com/services/rest')
.query(defaults)
Expand Down
2 changes: 1 addition & 1 deletion script/build-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function requiredArguments(info) {
var obj = {};

info.arguments.argument.filter(function (arg) {
return !parseInt(arg.optional, 10);
return !parseInt(arg.optional, 10) && arg.name !== 'api_key';
}).forEach(function (arg) {
obj[arg.name] = '_';
});
Expand Down
12 changes: 1 addition & 11 deletions test/flickr.activity.userComments.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ var assert = require('assert');

describe('flickr.activity.userComments', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.activity.userComments({});
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('returns a Request instance', function () {
var req = flickr.activity.userComments({ api_key: '_' });
var req = flickr.activity.userComments({});

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
12 changes: 1 addition & 11 deletions test/flickr.activity.userPhotos.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ var assert = require('assert');

describe('flickr.activity.userPhotos', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.activity.userPhotos({});
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('returns a Request instance', function () {
var req = flickr.activity.userPhotos({ api_key: '_' });
var req = flickr.activity.userPhotos({});

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
14 changes: 2 additions & 12 deletions test/flickr.auth.checkToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@ var assert = require('assert');

describe('flickr.auth.checkToken', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.auth.checkToken({ auth_token: '_' });
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('requires "auth_token"', function () {

assert.throws(function () {
flickr.auth.checkToken({ api_key: '_' });
flickr.auth.checkToken({});
}, function (err) {
return err.message === 'Missing required argument "auth_token"';
});

});

it('returns a Request instance', function () {
var req = flickr.auth.checkToken({ api_key: '_', auth_token: '_' });
var req = flickr.auth.checkToken({ auth_token: '_' });

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
12 changes: 1 addition & 11 deletions test/flickr.auth.getFrob.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ var assert = require('assert');

describe('flickr.auth.getFrob', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.auth.getFrob({});
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('returns a Request instance', function () {
var req = flickr.auth.getFrob({ api_key: '_' });
var req = flickr.auth.getFrob({});

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
14 changes: 2 additions & 12 deletions test/flickr.auth.getFullToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@ var assert = require('assert');

describe('flickr.auth.getFullToken', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.auth.getFullToken({ mini_token: '_' });
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('requires "mini_token"', function () {

assert.throws(function () {
flickr.auth.getFullToken({ api_key: '_' });
flickr.auth.getFullToken({});
}, function (err) {
return err.message === 'Missing required argument "mini_token"';
});

});

it('returns a Request instance', function () {
var req = flickr.auth.getFullToken({ api_key: '_', mini_token: '_' });
var req = flickr.auth.getFullToken({ mini_token: '_' });

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
14 changes: 2 additions & 12 deletions test/flickr.auth.getToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@ var assert = require('assert');

describe('flickr.auth.getToken', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.auth.getToken({ frob: '_' });
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('requires "frob"', function () {

assert.throws(function () {
flickr.auth.getToken({ api_key: '_' });
flickr.auth.getToken({});
}, function (err) {
return err.message === 'Missing required argument "frob"';
});

});

it('returns a Request instance', function () {
var req = flickr.auth.getToken({ api_key: '_', frob: '_' });
var req = flickr.auth.getToken({ frob: '_' });

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
14 changes: 2 additions & 12 deletions test/flickr.auth.oauth.checkToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@ var assert = require('assert');

describe('flickr.auth.oauth.checkToken', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.auth.oauth.checkToken({ oauth_token: '_' });
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('requires "oauth_token"', function () {

assert.throws(function () {
flickr.auth.oauth.checkToken({ api_key: '_' });
flickr.auth.oauth.checkToken({});
}, function (err) {
return err.message === 'Missing required argument "oauth_token"';
});

});

it('returns a Request instance', function () {
var req = flickr.auth.oauth.checkToken({ api_key: '_', oauth_token: '_' });
var req = flickr.auth.oauth.checkToken({ oauth_token: '_' });

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
12 changes: 1 addition & 11 deletions test/flickr.auth.oauth.getAccessToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ var assert = require('assert');

describe('flickr.auth.oauth.getAccessToken', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.auth.oauth.getAccessToken({});
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('returns a Request instance', function () {
var req = flickr.auth.oauth.getAccessToken({ api_key: '_' });
var req = flickr.auth.oauth.getAccessToken({});

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
12 changes: 1 addition & 11 deletions test/flickr.blogs.getList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ var assert = require('assert');

describe('flickr.blogs.getList', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.blogs.getList({});
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('returns a Request instance', function () {
var req = flickr.blogs.getList({ api_key: '_' });
var req = flickr.blogs.getList({});

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
12 changes: 1 addition & 11 deletions test/flickr.blogs.getServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ var assert = require('assert');

describe('flickr.blogs.getServices', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.blogs.getServices({});
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('returns a Request instance', function () {
var req = flickr.blogs.getServices({ api_key: '_' });
var req = flickr.blogs.getServices({});

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
18 changes: 4 additions & 14 deletions test/flickr.blogs.postPhoto.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,10 @@ var assert = require('assert');

describe('flickr.blogs.postPhoto', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.blogs.postPhoto({ photo_id: '_', title: '_', description: '_' });
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('requires "photo_id"', function () {

assert.throws(function () {
flickr.blogs.postPhoto({ api_key: '_', title: '_', description: '_' });
flickr.blogs.postPhoto({ title: '_', description: '_' });
}, function (err) {
return err.message === 'Missing required argument "photo_id"';
});
Expand All @@ -26,7 +16,7 @@ describe('flickr.blogs.postPhoto', function () {
it('requires "title"', function () {

assert.throws(function () {
flickr.blogs.postPhoto({ api_key: '_', photo_id: '_', description: '_' });
flickr.blogs.postPhoto({ photo_id: '_', description: '_' });
}, function (err) {
return err.message === 'Missing required argument "title"';
});
Expand All @@ -36,15 +26,15 @@ describe('flickr.blogs.postPhoto', function () {
it('requires "description"', function () {

assert.throws(function () {
flickr.blogs.postPhoto({ api_key: '_', photo_id: '_', title: '_' });
flickr.blogs.postPhoto({ photo_id: '_', title: '_' });
}, function (err) {
return err.message === 'Missing required argument "description"';
});

});

it('returns a Request instance', function () {
var req = flickr.blogs.postPhoto({ api_key: '_', photo_id: '_', title: '_', description: '_' });
var req = flickr.blogs.postPhoto({ photo_id: '_', title: '_', description: '_' });

assert.equal(req.method, 'POST');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
14 changes: 2 additions & 12 deletions test/flickr.cameras.getBrandModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@ var assert = require('assert');

describe('flickr.cameras.getBrandModels', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.cameras.getBrandModels({ brand: '_' });
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('requires "brand"', function () {

assert.throws(function () {
flickr.cameras.getBrandModels({ api_key: '_' });
flickr.cameras.getBrandModels({});
}, function (err) {
return err.message === 'Missing required argument "brand"';
});

});

it('returns a Request instance', function () {
var req = flickr.cameras.getBrandModels({ api_key: '_', brand: '_' });
var req = flickr.cameras.getBrandModels({ brand: '_' });

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
12 changes: 1 addition & 11 deletions test/flickr.cameras.getBrands.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,8 @@ var assert = require('assert');

describe('flickr.cameras.getBrands', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.cameras.getBrands({});
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('returns a Request instance', function () {
var req = flickr.cameras.getBrands({ api_key: '_' });
var req = flickr.cameras.getBrands({});

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
14 changes: 2 additions & 12 deletions test/flickr.collections.getInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,18 @@ var assert = require('assert');

describe('flickr.collections.getInfo', function () {

it('requires "api_key"', function () {

assert.throws(function () {
flickr.collections.getInfo({ collection_id: '_' });
}, function (err) {
return err.message === 'Missing required argument "api_key"';
});

});

it('requires "collection_id"', function () {

assert.throws(function () {
flickr.collections.getInfo({ api_key: '_' });
flickr.collections.getInfo({});
}, function (err) {
return err.message === 'Missing required argument "collection_id"';
});

});

it('returns a Request instance', function () {
var req = flickr.collections.getInfo({ api_key: '_', collection_id: '_' });
var req = flickr.collections.getInfo({ collection_id: '_' });

assert.equal(req.method, 'GET');
assert.equal(req.url, 'https://api.flickr.com/services/rest');
Expand Down
Loading

0 comments on commit 4dcb33e

Please sign in to comment.