Ejemplo n.º 1
0
def test_get_test_router():
    with setting(TEST_RAPIDSMS_ROUTER='rapidsms.tests.router.test_base.BadClassName'):
        assert_raises(ImproperlyConfigured, get_test_router)
    with setting(TEST_RAPIDSMS_ROUTER='rapidsms.tests.router.bad_module.MockRouter'):
        assert_raises(ImproperlyConfigured, get_test_router)
    with setting(TEST_RAPIDSMS_ROUTER='rapidsms.tests.router.test_base.MockRouter'):
        assert_equals(get_test_router(), MockRouter)
Ejemplo n.º 2
0
def test_get_router():
    with setting(
            RAPIDSMS_ROUTER='rapidsms.tests.router.test_base.BadClassName'):
        assert_raises(ImproperlyConfigured, get_router)
    with setting(
            RAPIDSMS_ROUTER='rapidsms.tests.router.bad_module.MockRouter'):
        assert_raises(ImproperlyConfigured, get_router)
    with setting(RAPIDSMS_ROUTER='rapidsms.tests.router.test_base.MockRouter'):
        assert_equals(get_router(), MockRouter)
Ejemplo n.º 3
0
def test_get_router():
    bad_module_router = 'rapidsms.tests.router.bad_module.MockRouter'
    bad_class_router = 'rapidsms.tests.router.test_base.BadClassName'
    good_mock_router = 'rapidsms.tests.router.test_base.MockRouter'
    with setting(RAPIDSMS_ROUTER=bad_module_router):
            assert_raises(ImproperlyConfigured, get_router)
    with setting(RAPIDSMS_ROUTER=bad_class_router):
            assert_raises(ImproperlyConfigured, get_router)
    with setting(RAPIDSMS_ROUTER=good_mock_router):
            assert_true(isinstance(get_router(), MockRouter))