{"_id":"facetest","_rev":"6-973ed73636eddb6a32d4682960790f7c","name":"facetest","description":"lib to provide easier creation of facebook test users for unit testing","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"author":{"name":"Cristiano Oliveira","email":"ocean.cris@gmail.com","url":"http://twitter.com/cris_o"},"name":"facetest","description":"lib to provide easier creation of facebook test users for unit testing","version":"0.1.0","homepage":"https://github.com/criso/facetest","repository":{"type":"git","url":"git://github.com/criso/facetest.git"},"main":"index.js","engines":{"node":">=0.4.12"},"dependencies":{"fbgraph":">=0.1.0"},"devDependencies":{},"_npmUser":{"name":"criso","email":"ocean.cris@gmail.com"},"_id":"facetest@0.1.0","_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.2","_defaultsLoaded":true,"dist":{"shasum":"654cd1cb34c37328aa3128d021a00b530a140b9f","tarball":"https://registry.npmjs.org/facetest/-/facetest-0.1.0.tgz","integrity":"sha512-xpbe4YCfuUHbiiQOXsJu/l8JC6UWhpJOjOmGNQkuOHXfAyNNsPKVThOwXiHoPQ6TdB0IwBnXOWIfeHIV7HJIwQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICwVESp/sKue6Ymgan+/YnZz59cXApXcQ2+w3EwGzJnvAiBswHoRJ1cMpzjJ9n4yHWuttawqU7d0ukYLrzP2tGVlfw=="}]},"maintainers":[{"name":"criso","email":"ocean.cris@gmail.com"}]}},"readme":"##dd  What?!\n[FaceTest](http://criso.github.com/facetest/) - nodejs module to facilitate api tests that require facebook test users\n\n## What?!!\nCreating facebook test users is pain.   \nIf you're building a `facebook` app or a web app that needs interacts with facebook user objects, this should make your life easier.\n\n\n## Installation via npm\n    $ npm install facetest\n\n\n## Init\nWhen creating a `facetest` object you'll need to pass in a facebook config object.\n\n```js\nvar config = {\n  appId:      <Your App Id>,\n  appSecret:  <Your App Secret>,\n  appInstalled: true,\n  scope:      'email, user_about_me, user_birthday, user_location, publish_stream, read_stream, friends_location',\n};\n\nvar FaceTest = require('facetest')\n  , facetest = new FaceTest(config);\n\n```\n\n## Create a test User\nCreates a facebook test user based on name given\n\n```js\n    var FaceTest = require('facetest')\n      , facetest = new FaceTest(config);\n\n    facetest.createUser('Magic Man', function (err, user) {\n      console.log(user); // { 'Magic Man': { id: ..., email: ....} }\n    });\n```\n\n## Create several test users\nCreates facebook test users based on an array of names\n\n```js\n    var FaceTest = require('facetest')\n      , facetest = new FaceTest(config);\n\n    var multipleUsers = ['Ricky Bobby', 'El Diablo', 'Magic Man'];\n\n    facetest.createUsers(multipleUsers, function(err, users) {\n      console.log(users);\n      // {\n      //  'Ricky Bobby':  { id: ..., email: ....}\n      //  'El Diablo':     { id: ..., email: ....}\n      //  'Magic Man':     { id: ..., email: ....}\n      // }\n    });\n```\n\n## Create facebook friends\n`createFriends()` expects an object containing an array of names\nThis will create facebook test users for all the names given.  \n  \nThe key of the object is an `anchor user`, which will have a friend\nrelationship with all the users in the given array.  \n  \nEach user will have a `friend object`.  \n\n```js\n    var FaceTest = require('facetest')\n      , facetest = new FaceTest(config);\n\n    var friends = {\n      'Ron Burgundy': ['Ricky Bobby', 'El Diablo', 'Veronica Corningstone']\n    };\n\n    // Ron Burgundy will be friends with Ricky bobby, El Diablo and Veronica Corningstone\n    // Ricky Bobby will *NOT* be friends with El Diablo. Infinite Sadness.\n    facetest.createFriends(friends, function(err, users) {\n      console.log(users);\n      // {\n      //    'Ron Burgundy':          { id: ..., email: ...., friends: [object, object, object]}\n      //  , 'Ricky Bobby':           { id: ..., email: ...., friends: [object]}\n      //  , 'El Diablo':             { id: ..., email: ...., friends: [object]}\n      //  , 'Veronica Corningstone': { id: ..., email: ...., friends: [object]}\n      // }\n    });\n```\n\n## Sample test\n```js\n  var vows     = require('vows')\n    , assert   = require('assert')\n    , FaceTest = require('facetest');\n\n  var facetest = new FaceTest();\n\n  vows.describe(\"testUser.test\").addBatch({\n    'After multiple users creation': {\n      topic:  function () {\n        var friends = {\n          'Ron Burgundy': ['Ricky Bobby', 'El Diablo', 'Veronica Corningstone']\n        };\n\n        facetest.createFriends(friends, this.callback);\n      },\n\n      'posting a blog post with facebook id':  {\n        topic: function (users) {\n\n          var user = facetest.getFacebookUser('El Diablo');\n          client.post('/post/1/facebook_id/' + user.id, this.callback);\n        },\n\n        'response': function (err, response) {\n          // test response from `/post/1/facebook_id/<facebook_id>`\n        }\n      }\n    }\n  }).addBatch({\n    'After test is over': {\n      topic:  function () {\n        facetest.removeAllFacebookUsers(this.callback);\n      },\n\n      'test users should be deleted': function (err, res) {\n        assert.isNull(err);\n        assert.equal(res.data, \"true\");\n        assert.isEmpty(faceTest.getFacebookUsers());\n      }\n    }\n  }).export(module);\n```\n\n## Running tests\n\n Before running the test suite, add your Facebook `appId` and `appSecret` to `tests/config.js`   \n This is needed to create `test users` and to get a test `access_token`\n\n    $ npm install\n    $ make test\n\n _Tests might fail if the Facebook api has an issue._\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2011 Cristiano Oliveira &lt;ocean.cris@gmail.com&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"criso","email":"ocean.cris@gmail.com"}],"time":{"modified":"2022-06-17T23:16:39.080Z","created":"2011-11-25T00:01:50.850Z","0.1.0":"2011-11-25T00:01:54.752Z"},"author":{"name":"Cristiano Oliveira","email":"ocean.cris@gmail.com","url":"http://twitter.com/cris_o"},"repository":{"type":"git","url":"git://github.com/criso/facetest.git"},"users":{"adrian_gierakowski":true}}