Comments (6)
I've added documentation on how to regenerate any cassette: https://github.com/Jesus/dropbox_api#testing
We only have procedures to regenerate the cassettes for get_metadata
and list_folder
, the others will be implemented as they're needed. I don't think there's need to build them all at once.
I think we can close this ticket now as your issue with the content_hash
attribute was also resolved. If I've missed anything please re-open.
from dropbox_api.
I'm sorry, the files aren't available anywhere, and the cassettes aren't easy to regenerate because the state of the Dropbox account changes after collecting new recordings.
For example, if I run dropbox.delete("file.txt")
and record the result on a cassette, I would need to upload file.txt
again in order to record the same cassette again. So I normally just get one real recording from Dropbox and work from there.
This is a real problem when it comes to test this library.
Ideally, we would have an automatic way to set up the required files in the test Dropbox account. Unfortunately, this isn't an option with the current code. The only reason why I didn't do this from the beginning is because I didn't have a way to do this automatically (for example, the upload endpoint wasn't available), now it's a good time to do it.
As a workaround until we have a better way to set up the test account, I can suggest some different solutions:
- Manually upload the files to the Dropbox account.
- Manually update the existing VCR cassettes to mimic the response you know Dropbox should respond. Take care with care.
from dropbox_api.
Thanks for the comment Jesus. I will take a look at your two options and see if I can find an easy way for this. I agree that the way you describe would be a better way (using the upload endpoint to restore original state), but that would indeed require some work. Perhaps split it off in another issue?
from dropbox_api.
I've started working on a solution to the testing problem.
I think you can already start using what I just did. I think you just need to regenerate the cassettes for get_metadata
, you can regenerate those cassettes with a few rake tasks.
- Manually delete the existing cassettes in
spec/fixtures/vcr_cassettes/get_metadata
. - Run
DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER rake test:build_scaffold:get_metadata
. - Run
DROPBOX_OAUTH_BEARER=YOUR_AUTH_BEARER rspec spec/endpoints/files/get_metadata_spec.rb
. After this, the cassettes will be written already, but your token is embed on it. - You need to remove your auth bearer from the cassettes before doing the commit. There's also a rake task to help on that:
rake test:vcr:mock_authorization_bearer
I reckon this is still a lot of manual work, but it's just a start and it will let you continue work for now.
from dropbox_api.
Great! This scaffolding worked for me, after a small adjustment (see #16).
Unfortunately, it seems my original problem still exists. If I add the content_hash field, all the cassettes need to be regenerated, because the content_hash field can't be populated with the old cassettes that do not contain this value yet. This might require some more scaffolding.
from dropbox_api.
Are you saying that you need to regenerate the cassettes for all existing endpoints?
If that's the case I'm afraid it's going to take a while before I write scaffoldings for all of them...
Looks like all you wanted was to add support for the new content_hash
attribute. If you want, you can open a PR with whatever progress you've done already. From there, we can work together to finish this particular request more quickly.
from dropbox_api.
Related Issues (20)
- Invalid value for `match_type`: {".tag"=>"both_filename_and_content"}
- When will you release the next version? HOT 2
- Release v0.1.11
- Net::OpenTimeout at... execution expired HOT 3
- List_folder result entries breaks for shared folder HOT 1
- Access data value HOT 1
- Please upgrade dependency faraday to ~> 0.17 HOT 2
- Anyway to download online file with dl=0 or dl=1? HOT 1
- please use more reasonable faraday restriction, allow 1.0.1? HOT 3
- Please update search endpoint to use the v2 path HOT 4
- Refresh tokens support HOT 6
- Catching 401 HOT 2
- WARNING: Faraday::Connection#authorization HOT 1
- Token is malformed, Expecting "Bearer <oauth2-access-token>" HOT 2
- Dropbox
- support faraday 2.0? HOT 5
- The client doesn't work for the business api access token. HOT 1
- update to 2.x of `oauth` gem as dependency? HOT 3
- How do you get the token_hash for refresh tokens? HOT 3
- NoMethodError raised when dropbox responds with 429
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dropbox_api.