Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for testing with WireMock #487

Open
djcoleman opened this issue Jan 24, 2023 · 1 comment
Open

Add support for testing with WireMock #487

djcoleman opened this issue Jan 24, 2023 · 1 comment

Comments

@djcoleman
Copy link

Hi,

We have some tests that verify our application can connect and interact with DropBox. Ideally, we'd like to be able to run these tests as part of our CI builds without requiring user credentials to be set up and shared.

I tried to use WireMock to capture real data for use in the mocked interactions, but ran into a couple of issues:

  1. Although there is a public constructor on DbxClientV2 that accepts a DbxHost object with custom URLs, there wasn't one with the correct combination of parameters that we needed. Our application uses the DbxClientV2(DbxRequestConfig, DbxCredential), so I'd have liked to append the DbxHost argument to that. Or failing that, call the private all-args constructor, which is essentially what I ended up doing via reflection.
  2. Even with a client configured to use a WireMock endpoint at localhost:{randomPort}, I got a URISyntaxException when trying to connect:
java.lang.RuntimeException: URI creation failed, host="localhost:38343", path="2/files/get_metadata": Malformed IPv6 address at index 9: https://[localhost:38343]/2/files/get_metadata
		at com.dropbox.core.util.LangUtil.mkAssert(LangUtil.java:15)
		at com.dropbox.core.DbxRequestUtil.buildUri(DbxRequestUtil.java:73)
		at com.dropbox.core.DbxRequestUtil.startPostRaw(DbxRequestUtil.java:269)
		at com.dropbox.core.v2.DbxRawClientV2$1.execute(DbxRawClientV2.java:146)
		at com.dropbox.core.v2.DbxRawClientV2.executeRetriable(DbxRawClientV2.java:330)
		at com.dropbox.core.v2.DbxRawClientV2.executeRetriableWithRefresh(DbxRawClientV2.java:351)
		at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:137)
		at com.dropbox.core.v2.files.DbxUserFilesRequests.getMetadata(DbxUserFilesRequests.java:1571)
		at com.dropbox.core.v2.files.DbxUserFilesRequests.getMetadata(DbxUserFilesRequests.java:1603)

Are there any plans to make the host and port configurable?

@greg-db
Copy link
Contributor

greg-db commented Jan 24, 2023

I'm not aware of plans to implement these currently, but I'll pass these along as feature requests. I can't promise if or when they might be implemented though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants