-
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
9 changed files
with
121 additions
and
43 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 @@ | ||
import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) |
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,4 @@ | ||
import os | ||
|
||
SCHEME = os.environ.get("API_SCHEME", "http") | ||
NETLOC = os.environ.get("API_NETLOC", "ex.com") |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
|
||
|
||
from app.utils import parser | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = parser() | ||
args = parser.parse_args() | ||
print(args) |
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 @@ | ||
import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__))) |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from app.utils import Shortener | ||
from tests.test_db import script, manager_mock | ||
import pytest | ||
from unittest import mock | ||
|
||
|
||
def test_get_long_url(db_mock): | ||
db_mock.executescript(script) | ||
with manager_mock(db_mock, 'db.get_db', 'db.db_manager'): | ||
with pytest.raises(Exception, match=r".* URL does .*"): | ||
Shortener.get_long_url('raise') | ||
inst = Shortener.get_long_url('goo.gl') | ||
assert type(inst) is str | ||
assert inst == 'https://www.google.com/' | ||
|
||
def test_get_long_url(db_mock): | ||
db_mock.executescript(script) | ||
with manager_mock(db_mock, 'db.get_db', 'db.db_manager'): | ||
inst = Shortener.gen_short_url('https://www.google.com/') | ||
assert type(inst) is str | ||
assert inst == 'goo.gl' |