diff options
| author | Vladimir Gorej | 2012-05-27 20:14:17 +0200 |
|---|---|---|
| committer | Vladimir Gorej | 2012-05-27 20:14:17 +0200 |
| commit | 4bd7b72aa0ca3a09ab99e1a3b41753df81de6af9 (patch) | |
| tree | 6328ed9894666eefc1f0d6b6c7b28a87b1fb4d31 /brevisurl/tests/test_brevisurl.py | |
| download | django-brevisurl-4bd7b72aa0ca3a09ab99e1a3b41753df81de6af9.tar.bz2 | |
Initial commit
Diffstat (limited to 'brevisurl/tests/test_brevisurl.py')
| -rw-r--r-- | brevisurl/tests/test_brevisurl.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/brevisurl/tests/test_brevisurl.py b/brevisurl/tests/test_brevisurl.py new file mode 100644 index 0000000..8780b05 --- /dev/null +++ b/brevisurl/tests/test_brevisurl.py @@ -0,0 +1,22 @@ +from django.utils import unittest + +from brevisurl import get_connection, shorten_url +from brevisurl.backends.local import BrevisUrlBackend +from brevisurl.backends.base import BaseBrevisUrlBackend + + +class TestGetConnection(unittest.TestCase): + + def test_get_default_connection(self): + connection = get_connection() + self.assertIsInstance(connection, BrevisUrlBackend) + + def test_get_custom_connection(self): + base_connection = get_connection(backend='brevisurl.backends.base.BaseBrevisUrlBackend') + local_connection = get_connection(backend='brevisurl.backends.local.BrevisUrlBackend') + self.assertIsInstance(base_connection, BaseBrevisUrlBackend) + self.assertIsInstance(local_connection, BrevisUrlBackend) + + def test_get_connection_non_existing_backend(self): + with self.assertRaises(AttributeError): + get_connection(backend='brevisurl.backends.local.NonExistingBackend')
\ No newline at end of file |
