-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from maykinmedia/feature/28-local-base-urls
Feature/28 local base urls
- Loading branch information
Showing
14 changed files
with
161 additions
and
7 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
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
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
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,6 +1,7 @@ | ||
""" | ||
Test the API interface to handle comparing of loose-fk urls | ||
""" | ||
|
||
import pytest | ||
import requests_mock | ||
|
||
|
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,56 @@ | ||
""" | ||
Test django_loose_fk.utils.is_local function with various | ||
combinations of settings | ||
""" | ||
|
||
from django.test import override_settings | ||
|
||
from django_loose_fk.utils import is_local | ||
|
||
|
||
@override_settings( | ||
LOOSE_FK_LOCAL_BASE_URLS=["http://api.example.nl/ozgv-t/zaken"], | ||
) | ||
def test_with_setting_same_host_same_prefix(): | ||
assert ( | ||
is_local(host="api.example.nl", url="http://api.example.nl/ozgv-t/zaken/1") | ||
is True | ||
) | ||
|
||
|
||
@override_settings( | ||
LOOSE_FK_LOCAL_BASE_URLS=["http://api.example.nl/ozgv-t/zaken"], | ||
) | ||
def test_with_setting_same_host_diff_prefix(): | ||
assert ( | ||
is_local(host="api.example.nl", url="http://api.example.nl/ozgv-t/documenten/1") | ||
is False | ||
) | ||
|
||
|
||
@override_settings( | ||
LOOSE_FK_LOCAL_BASE_URLS=["http://otherapi.example.nl/ozgv-t/zaken"], | ||
) | ||
def test_with_setting_diff_host(): | ||
assert ( | ||
is_local(host="api.example.nl", url="http://otherapi.example.nl/ozgv-t/zaken/1") | ||
is True | ||
) | ||
|
||
|
||
def test_no_setting_same_host_with_prefix(): | ||
assert ( | ||
is_local(host="api.example.nl", url="http://api.example.nl/ozgv-t/zaken/1") | ||
is True | ||
) | ||
|
||
|
||
def test_no_setting_same_host_no_prefix(): | ||
assert is_local(host="api.example.nl", url="http://api.example.nl/zaken/1") is True | ||
|
||
|
||
def test_no_setting_diff_host(): | ||
assert ( | ||
is_local(host="api.example.nl", url="http://otherapi.example.nl/ozgv-t/zaken/1") | ||
is False | ||
) |
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,6 +1,7 @@ | ||
""" | ||
Test that it's possibly to handle remote/local objects transparently. | ||
""" | ||
|
||
import uuid | ||
|
||
import pytest | ||
|
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,6 +1,7 @@ | ||
""" | ||
Test the ORM queries against the virtual field. | ||
""" | ||
|
||
import pytest | ||
import requests_mock | ||
|
||
|