nebulab-dropbox
Version:
Client library for the Dropbox API
130 lines (106 loc) • 5.64 kB
text/coffeescript
describe 'Dropbox.Http.AppInfo', ->
describe '.parse', ->
describe 'on a datastores app', ->
beforeEach ->
appInfo = {
"name": "Datastores sample app",
"icons": {
"64x64": "https://photos-1.dropbox.com/pi/64x64/OkMXX6d3pl00VrcKu6p-hfjS5wvz9I1j4Nn2sZDFsVs/0/1376456400/7482db5/"
},
"permissions": {
"datastores": true
}
}
= Dropbox.Http.AppInfo.parse appInfo, 'qre1rsgf4iszxcu'
it 'parses name correctly', ->
expect().to.have.property 'name'
expect(.name).to.equal 'Datastores sample app'
it 'parses canUseDatastores correctly', ->
expect().to.have.property 'canUseDatastores'
expect(.canUseDatastores).to.equal true
it 'parses canUseFiles correctly', ->
expect().to.have.property 'canUseFiles'
expect(.canUseFiles).to.equal false
it 'parses canUseFullDropbox correctly', ->
expect().to.have.property 'canUseFullDropbox'
expect(.canUseFullDropbox).to.equal false
it 'parses hasAppFolder correctly', ->
expect().to.have.property 'hasAppFolder'
expect(.hasAppFolder).to.equal false
describe '#icon', ->
it 'returns the small icon correctly', ->
expect(.icon(Dropbox.Http.AppInfo.ICON_SMALL)).to.equal(
'https://photos-1.dropbox.com/pi/64x64/OkMXX6d3pl00VrcKu6p-hfjS5wvz9I1j4Nn2sZDFsVs/0/1376456400/7482db5/')
it 'returns the lack of a large icon correctly', ->
expect(.icon(Dropbox.Http.AppInfo.ICON_LARGE)).to.equal null
it 'interprets height correctly', ->
expect(.icon(Dropbox.Http.AppInfo.ICON_SMALL,
Dropbox.Http.AppInfo.ICON_SMALL)).to.equal(
'https://photos-1.dropbox.com/pi/64x64/OkMXX6d3pl00VrcKu6p-hfjS5wvz9I1j4Nn2sZDFsVs/0/1376456400/7482db5/')
expect(.icon(Dropbox.Http.AppInfo.ICON_SMALL,
Dropbox.Http.AppInfo.ICON_LARGE)).to.equal null
describe 'on an app folder app', ->
beforeEach ->
appInfo = {
"name": "Automated Testing Keys",
"icons": {
"64x64": "https://photos-1.dropbox.com/pi/64x64/KXc4DqzIbFpIAPel2rvJv1yNSAVRVTjACYKynaM2K_g/0/1376524800/4ead4f2/",
"256x256": "https://photos-4.dropbox.com/pi/256x256/EphMShFe8Orja4WRPlkUnBZNABs-V2WbhkZZlAnVFe0/0/1376524800/fb0e049/"
},
"permissions": {
"datastores": true,
"files": "app_folder"
}
}
= Dropbox.Http.AppInfo.parse appInfo, 'qre1rsgf4iszxcu'
it 'parses name correctly', ->
expect().to.have.property 'name'
expect(.name).to.equal 'Automated Testing Keys'
it 'parses canUseDatastores correctly', ->
expect().to.have.property 'canUseDatastores'
expect(.canUseDatastores).to.equal true
it 'parses canUseFiles correctly', ->
expect().to.have.property 'canUseFiles'
expect(.canUseFiles).to.equal true
it 'parses canUseFullDropbox correctly', ->
expect().to.have.property 'canUseFullDropbox'
expect(.canUseFullDropbox).to.equal false
it 'parses hasAppFolder correctly', ->
expect().to.have.property 'hasAppFolder'
expect(.hasAppFolder).to.equal true
describe '#icon', ->
it 'returns the small icon correctly', ->
expect(.icon(Dropbox.Http.AppInfo.ICON_SMALL)).to.equal(
'https://photos-1.dropbox.com/pi/64x64/KXc4DqzIbFpIAPel2rvJv1yNSAVRVTjACYKynaM2K_g/0/1376524800/4ead4f2/')
it 'returns the large icon correctly', ->
expect(.icon(Dropbox.Http.AppInfo.ICON_LARGE)).to.equal(
'https://photos-4.dropbox.com/pi/256x256/EphMShFe8Orja4WRPlkUnBZNABs-V2WbhkZZlAnVFe0/0/1376524800/fb0e049/')
describe 'on a full Dropbox app', ->
beforeEach ->
appInfo = {
"name": "Automated Testing Keys (Full Access)",
"icons": {
"64x64": "https://photos-1.dropbox.com/pi/64x64/KXc4DqzIbFpIAPel2rvJv1yNSAVRVTjACYKynaM2K_g/0/1376524800/4ead4f2/",
"256x256": "https://photos-4.dropbox.com/pi/256x256/EphMShFe8Orja4WRPlkUnBZNABs-V2WbhkZZlAnVFe0/0/1376524800/fb0e049/"
},
"permissions": {
"datastores": true,
"files": "full_dropbox"
}
}
= Dropbox.Http.AppInfo.parse appInfo, 'qre1rsgf4iszxcu'
it 'parses name correctly', ->
expect().to.have.property 'name'
expect(.name).to.equal 'Automated Testing Keys (Full Access)'
it 'parses canUseDatastores correctly', ->
expect().to.have.property 'canUseDatastores'
expect(.canUseDatastores).to.equal true
it 'parses canUseFiles correctly', ->
expect().to.have.property 'canUseFiles'
expect(.canUseFiles).to.equal true
it 'parses canUseFullDropbox correctly', ->
expect().to.have.property 'canUseFullDropbox'
expect(.canUseFullDropbox).to.equal true
it 'parses hasAppFolder correctly', ->
expect().to.have.property 'hasAppFolder'
expect(.hasAppFolder).to.equal false