-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
107 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
language: python | ||
|
||
cache: pip | ||
|
||
python: | ||
- "3.6" | ||
|
||
install: | ||
- pip install -r dev-requirements.txt | ||
- pip install coveralls | ||
|
||
script: | ||
- make tests | ||
|
||
after_script: | ||
- coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
# Python database url | ||
# Py-Database-URL | ||
|
||
[![Build Status](https://travis-ci.org/jairojair/py-database-url.svg?branch=master)](https://travis-ci.org/jairojair/py-database-url) | ||
[![Coverage Status](https://coveralls.io/repos/github/jairojair/py-database-url/badge.svg?branch=master)](https://coveralls.io/github/jairojair/py-database-url?branch=master) | ||
|
||
## Installation | ||
|
||
pip install py-database-url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,39 @@ | ||
import pytest | ||
|
||
from py_database_url import parse | ||
from py_database_url import config | ||
|
||
|
||
def test_parse_without_url(): | ||
def test_config_without_url(): | ||
|
||
assert parse() is None | ||
assert config.parse() is None | ||
|
||
|
||
def test_parse_database_url(): | ||
""" | ||
Describe | ||
""" | ||
|
||
url = "postgres://user:password@hostname:5432/database-name" | ||
url = "postgres://user:password@hostname:5432/db-name" | ||
|
||
config = parse(url) | ||
ret = config.parse(url) | ||
|
||
assert config.username == "user" | ||
assert config.password == "password" | ||
assert config.hostname == "hostname" | ||
assert config.port == 5432 | ||
assert ret.username == "user" | ||
assert ret.password == "password" | ||
assert ret.hostname == "hostname" | ||
assert ret.port == 5432 | ||
|
||
|
||
def test_config_database_url_orator(): | ||
|
||
expected = { | ||
"postgres": { | ||
"database": "database-name", | ||
"driver": "postgres", | ||
"host": "hostname", | ||
"user": "user", | ||
"password": "password", | ||
"prefix": "", | ||
} | ||
} | ||
|
||
assert config.orator == expected |