describe('authorization methods', () => {
def('permissions', { documents: ['w'], photos: ['r', 'w'], contacts: ['r'], 'deep/dir': ['r', 'w'] });
before(async () => {
this.accessToken = await store.authorize('www.example.com', 'boris', get.permissions);
this.rootToken = await store.authorize('admin.example.com', 'zebcoe', { '': ['r', 'w'] });
});
describe('permissions', () => {
it('returns the users\'s authorizations', async () => {
const auth = await store.permissions('boris', this.accessToken);
expect(auth).to.be.deep.equal({ '/contacts/': ['r'],
'/deep/dir/': ['r', 'w'],
'/documents/': ['w'],
'/photos/': ['r', 'w'] });
});
});
describe('revokeAccess', () => {
it('removes the authorization from the store', async () => {
await store.revokeAccess('boris', this.accessToken);
const auth = await store.permissions('boris', this.accessToken);
expect(auth).to.be.deep.equal({});
});
});
});