Skip to content

Commit

Permalink
Remove getCurrentUser
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin01 committed Nov 6, 2014
1 parent 5884e3c commit b9bdbd0
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 51 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var anyfetchBasic = new AnyFetch('LOGIN', 'PASSWORD');
// OR
var anyfetch = new AnyFetch('TOKEN');

anyfetch.getCurrentUser(function(err, user) {
anyfetch.getUser(function(err, user) {
console.log('Hello, my name is ' + user.name);
};
```
Expand Down Expand Up @@ -184,7 +184,7 @@ anyfetch.createSubcompanyWithAdmin(subcompany, admin, function(err, company, adm
This function allows you to retrieve the user's info from its credentials (login / password or token).
```js
anyfetch.getCurrentUser(function(err, user) {
anyfetch.getUser(function(err, user) {
console.log('Hello, my name is ' + user.name);
};
```
Expand Down
6 changes: 3 additions & 3 deletions bin/make-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ mkdirp(mocksDirectory, function(err) {
anyfetch = new AnyFetch(res.body.token);

async.auto({
getCurrentUser: function(cb) {
anyfetch.getCurrentUser(function(err, user) {
getUser: function(cb) {
anyfetch.getUser(function(err, user) {
userId = user.id;
cb(err);
});
Expand Down Expand Up @@ -124,7 +124,7 @@ mkdirp(mocksDirectory, function(err) {
},

// Now the fake content is setup, we can test all the gets in parallel
endpoints: ['getCurrentUser', 'postSubcompanies', 'postDocuments', function(cb) {
endpoints: ['getUser', 'postSubcompanies', 'postDocuments', function(cb) {
var endpoints = [
'getDocuments',
'getStatus',
Expand Down
11 changes: 11 additions & 0 deletions lib/test-server/mocks/get-subcompanies-id.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,16 @@
"hydraters": [
"http://plaintext.hydrater.anyfetch.com/hydrate",
"http://pdf.hydrater.anyfetch.com/hydrate"
],
"childs": [
{
"_type": "Company",
"id": "53ce561cc2453be57db39688",
"name": "the_fake_subcompany2",
"hydraters": [
"http://plaintext.hydrater.anyfetch.com/hydrate",
"http://pdf.hydrater.anyfetch.com/hydrate"
]
}
]
}
8 changes: 8 additions & 0 deletions lib/test-server/mocks/get-user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"_type": "User",
"id": "52f0bb24c8318c2d65000036",
"email": "test@anyfetch.com",
"name": "Anyfetch Test",
"is_admin": true,
"user_url": "/users/52f0bb24c8318c2d65000036"
}
33 changes: 0 additions & 33 deletions lib/utility/get-current-user.js

This file was deleted.

13 changes: 0 additions & 13 deletions test/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ describe('<High-level helper functions>', function() {
});
});

describe('getCurrentUser()', function() {
it('should get the correct user', function(done) {
anyfetch.getCurrentUser(function(err, user) {
should(err).not.be.ok;
should(user).be.ok;
should(user).have.properties('id', 'email', 'name', 'is_admin');
user.email.should.eql(configuration.test.user.email);

done();
});
});
});

describe('createSubcompanyWithAdmin()', function() {
before(function reset(done) {
anyfetch.resetToBearer(done);
Expand Down

0 comments on commit b9bdbd0

Please sign in to comment.