Jan Dittberner
8dda40a363
This commit performs a lot of changes to make gvacommon properly distributable: - add a setup.py - move code into a module directory - add a __version__ - add a README.rst and AGPLv3 license file (COPYING) - specify the licensing in file headers - move tests into a submodule of gvacommon and split tests for different modules into separate test modules - get rid of django-braces dependency - adapt setup.cfg to the new directory structure - ignore build and dist directories
69 lines
2.3 KiB
Python
69 lines
2.3 KiB
Python
#
|
|
# gvacommon - common parts of gnuviechadmin
|
|
# Copyright (C) 2014-2016 Jan Dittberner
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
"""
|
|
Tests for gvacommon celery router code.
|
|
|
|
"""
|
|
from __future__ import absolute_import, unicode_literals
|
|
import unittest
|
|
|
|
from gvacommon.celeryrouters import GvaRouter
|
|
|
|
|
|
class GvaRouteTest(unittest.TestCase):
|
|
|
|
def test_route_for_task_ldap(self):
|
|
router = GvaRouter()
|
|
route = router.route_for_task('ldap')
|
|
self.assertEqual(
|
|
route,
|
|
{'exchange': 'ldap', 'exchange_type': 'direct', 'queue': 'ldap'})
|
|
|
|
def test_route_for_task_file(self):
|
|
router = GvaRouter()
|
|
route = router.route_for_task('file')
|
|
self.assertEqual(
|
|
route,
|
|
{'exchange': 'file', 'exchange_type': 'direct', 'queue': 'file'})
|
|
|
|
def test_route_for_task_mysql(self):
|
|
router = GvaRouter()
|
|
route = router.route_for_task('mysql')
|
|
self.assertEqual(
|
|
route,
|
|
{'exchange': 'mysql', 'exchange_type': 'direct', 'queue': 'mysql'})
|
|
|
|
def test_route_for_task_pgsql(self):
|
|
router = GvaRouter()
|
|
route = router.route_for_task('pgsql')
|
|
self.assertEqual(
|
|
route,
|
|
{'exchange': 'pgsql', 'exchange_type': 'direct', 'queue': 'pgsql'})
|
|
|
|
def test_route_for_task_web(self):
|
|
router = GvaRouter()
|
|
route = router.route_for_task('web')
|
|
self.assertEqual(
|
|
route,
|
|
{'exchange': 'web', 'exchange_type': 'direct', 'queue': 'web'})
|
|
|
|
def test_route_for_task_other(self):
|
|
router = GvaRouter()
|
|
route = router.route_for_task('unknown')
|
|
self.assertIsNone(route)
|