Download:
child 172:5be4b5a42212
parent 170:ed9d9ccb3b4c
171:dd72c5809c96
Anton Shestakov <av6@dwimlabs.net>, Thu, 21 Jul 2016 23:35:01 +0800
tests: test Project.get_adapter()

1 файлов изменено, 12 вставок(+), 0 удалений(-) [+]
tests/test_models.py file | annotate | diff | comparison | revisions
--- a/tests/test_models.py Thu Jul 21 23:33:53 2016 +0800
+++ b/tests/test_models.py Thu Jul 21 23:35:01 2016 +0800
@@ -1,5 +1,6 @@
from datetime import datetime, timedelta
+from candolint import adapters
from candolint.models import database, Project, Change, Check
@@ -68,3 +69,14 @@
change = Change.get(id=change.id)
assert change.rev is None
assert change.id == old_id
+
+
+def test_get_adapter():
+ project = Project(domain='bitbucket.org', name='obviously-from-bitbucket')
+ assert isinstance(project.get_adapter(), adapters.BitbucketAdapter)
+
+ project = Project(domain='github.com', name='obviously-from-github')
+ assert isinstance(project.get_adapter(), adapters.GithubAdapter)
+
+ project = Project(domain='example.com', name='fallback')
+ assert isinstance(project.get_adapter(), adapters.HostingAdapter)