Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Remove dsn.lower() from influxdb08.InfluxDBClient.from_DSN() #190

Merged
merged 3 commits into from
Jun 2, 2015

Conversation

kipe
Copy link
Contributor

@kipe kipe commented Jun 1, 2015

InfluxDBClient.from_DSN() now behaves correctly and allows (for example) case-sensitive password.

@ChristopherRabotin
Copy link
Contributor

Thanks for spotting that. Could you add to the influxdb08 package the similar tests that we added to the main package? https://github.com/influxdb/influxdb-python/blob/master/tests/influxdb/client_test.py#L810

Thanks.

@kipe
Copy link
Contributor Author

kipe commented Jun 1, 2015

In my opinion these kinds of problems are easiest to capture by using the existing tests, but changing the case-sensitive fields (username and password, others?) to include values which use uppercase letters.

So for example tests/influxdb/influxdb08/client_test.py#L102 would change from
cli = InfluxDBClient.from_DSN('influxdb://usr:pwd@host:1886/db')
to
cli = InfluxDBClient.from_DSN('influxdb://uSr:pWd@host:1886/db')

Also, for easier change (and avoiding typos) the "base url" should be one variable, instead of rewriting it all the time (e.g. DSN_STRING = 'influxdb://uSr:pWd@host:1886/db'). This way the same "base url" could be used in all the cases, just by using 'udp+' + DSN_STRING for UDP-test etc.

I can try and do this today or tomorrow, but if this is the way to go, I'd rather create another pull request, as it affects multiple tests (I'd also do the changes to 0.9 at the same time).

kipe added a commit to kipe/influxdb-python that referenced this pull request Jun 1, 2015
Use `DSN_STRING` and `CLUSTER_DSN_STRING` instead of rewriting the whole string. Makes it easier to change, if and when tests are developed.
Change all `assert .* == .*`, `assert .* is True` and `assert .* is False` to use `assertEqual`, `assertTrue` and `assertFalse`. This is mainly for consistency, no "real" reason.

Discussed in PR influxdata#190.
kipe added a commit to kipe/influxdb-python that referenced this pull request Jun 1, 2015
Use `DSN_STRING` and `CLUSTER_DSN_STRING` instead of rewriting the whole string. Makes it easier to change, if and when tests are developed.
Change all `assert .* == .*`, `assert .* is True` and `assert .* is False` to use `assertEqual`, `assertTrue` and `assertFalse`. This is mainly for consistency, no "real" reason.

Discussed in PR influxdata#190. Fails tests, as long as that issue is merged (this commit fixes tests for that issue also).
Use `DSN_STRING` and `CLUSTER_DSN_STRING` instead of rewriting the whole string. Makes it easier to change, if and when tests are developed.

Change all `assert .* == .*`, `assert .* is True` and `assert .* is False` to use `assertEqual`, `assertTrue` and `assertFalse`. This is mainly for consistency, no "real" reason.
@kipe
Copy link
Contributor Author

kipe commented Jun 1, 2015

Just added some refactoring of the tests, which also modify the tests to include the situation this pull request fixes.

@@ -29,6 +29,9 @@
from influxdb import InfluxDBClient, InfluxDBClusterClient
from influxdb.client import InfluxDBServerError

DSN_STRING = 'influxdb://uSr:pWd@host:1886/db'
CLUSTER_DSN_STRING = 'influxdb://uSr:pWd@host1:8086,uSr:pWd@host2:8086/db'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you declare this in a set_up instead? I prefer not to have class-level attributes

@kipe
Copy link
Contributor Author

kipe commented Jun 1, 2015

Good point, changed as requested :)

@aviau
Copy link
Collaborator

aviau commented Jun 1, 2015

Thank you for your contributon @kipe !

@ChristopherRabotin Is that good to you?

@ChristopherRabotin
Copy link
Contributor

Yes, that looks good. Thanks for asking.

On Mon, Jun 1, 2015, 19:22 Alexandre Viau notifications@github.com wrote:

Thank you for your contributon @kipe https://github.com/kipe !

@ChristopherRabotin https://github.com/ChristopherRabotin Is that good
to you?


Reply to this email directly or view it on GitHub
#190 (comment)
.

aviau added a commit that referenced this pull request Jun 2, 2015
Remove dsn.lower() from influxdb08.InfluxDBClient.from_DSN()
@aviau aviau merged commit dee737d into influxdata:master Jun 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy