https://github.com/danielschaffer/fb-test-user-util
https://github.com/danielschaffer/fb-test-user-util
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/danielschaffer/fb-test-user-util
- Owner: DanielSchaffer
- Created: 2012-11-20T23:53:07.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-11-27T21:33:14.000Z (over 13 years ago)
- Last Synced: 2025-02-10T03:13:45.895Z (over 1 year ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
fb-test-user-util
=================
a javascript-based utility for adding test users and creating relationships between test users.
## running the utility
This utility can be run either as a node.js script, or using a web browser with a console.
### node.js
After cloning, run `npm install` in the cloned folder once. To run from the command line, run `node app command [commandname]` along with the required parameters from within the cloned folder.
Parameters are specified in pairs separated by spaces. For example:
node app command addTestUsers count 1 appID 1234 apiSecret abcd
The above executes the `addTestUsers` command, and passes the value `1` for the `count` parameter.
### web-based
After cloning, open the `index.html` file, which is used as the host. To run commands, open the web browser's javascript console. All parameters are passed in an options object. To run the `addTestUsers` command:
testUserUtil.addTestUsers({ count: 1, appID: '1234', apiSecret: 'abcd' });
Additionally, each command takes an optional callback parameter which is called when the command is complete:
testUserUtil.addTestUsers({ count: 1, appID: '1234', apiSecret: 'abcd' }, function() {
console.log('done!');
});
## commands
The following parameters are required for all commands:
* **appID** - the app's API key/app ID
* **apiSecret** - the app's API secret
### addTestUsers
Adds one or more test users to the app, and optionally adds them as friends to eachother or to all existing app test users.
**Required Parameters**
* **count** - *number* - the number of new test users to add
**Optional Parameters**
* **friendCreatedUsers** - *boolean* or *"random"*
* `true` - adds the created test users to eachothers friends lists
* `"random"` - each created user has a 50% chance of becoming friends with each other created user
* **friendAllUsers** - *boolean* or *"random"*
* `true` - adds all the created, and all existing test users, to eachothers friends lists
* `"random"` - each created user has a 50% chance of becoming friends with each created and existing user
* *note* - if both `friendCreatedUsers` and `friendAllUsers` are specified, the `friendCreatedUsers` behavior is used.
### friendAllAppUsers
Adds all test users to the user's friends list, if specified, or adds all test users to eachothers friends lists.
**Optional Parameters**
* **userId** - *string* - the FB user id of the test user to add friends to
* **random** - *boolean* - when set, users have a 50% chance of becoming friends
### deleteUsers
Deletes one or more specific test users, or all test users of an app.
*note* - Test users that have been added to multiple apps cannot be deleted until they are removed from the other apps.
**Required Parameters**
* **users** - *"all"* *or* *userlist*
* `"all"` - deletes all test users of the app
* `userlist` - a comma separated uid list (no spaces!), deletes all users in the list