Beispiel #1
0
def test_create_adds_language_to_db():
    """
        This should add the new language to the database session, whih is added only if it does not exit in a db.
        After successfully creating a new language it should redirect
    """
    request = _mock_request(matchdict={'public_group_id': '12345', 'language': 'zrrtgy'})
    result = views.add_language(request)
    request.db.add.assert_called_once()
    assert isinstance(result, httpexceptions.HTTPRedirection)
Beispiel #2
0
def test_create_redirects_to_translation_read_page(Language):
    """
        After successfully fetching a mock Language object it
         should not add that one into db but it should redirect.
    """
    language = mock.Mock(public_group_id='12345', language='language')
    Language.return_value = language
    request = _mock_request(matchdict={'public_group_id': '12345', 'language': 'test_language'})
    result = views.add_language(request)
    assert not request.db.add.called
    assert isinstance(result, httpexceptions.HTTPRedirection)
Beispiel #3
0
def test_create_adds_language_to_db():
    """
        This should add the new language to the database session, whih is added only if it does not exit in a db.
        After successfully creating a new language it should redirect
    """
    request = _mock_request(matchdict={
        'public_group_id': '12345',
        'language': 'zrrtgy'
    })
    result = views.add_language(request)
    request.db.add.assert_called_once()
    assert isinstance(result, httpexceptions.HTTPRedirection)
Beispiel #4
0
def test_create_redirects_to_translation_read_page(Language):
    """
        After successfully fetching a mock Language object it
         should not add that one into db but it should redirect.
    """
    language = mock.Mock(public_group_id='12345', language='language')
    Language.return_value = language
    request = _mock_request(matchdict={
        'public_group_id': '12345',
        'language': 'test_language'
    })
    result = views.add_language(request)
    assert not request.db.add.called
    assert isinstance(result, httpexceptions.HTTPRedirection)
Beispiel #5
0
def test_create_with_non_ascii_name():
    request = _mock_request(matchdict={
        'public_group_id': 'abc',
        'language': u"☆ ßüper Gröup ☆"
    })
    views.add_language(request)
Beispiel #6
0
def test_create_with_non_ascii_name():
    request = _mock_request(matchdict={'public_group_id': 'abc', 'language': u"☆ ßüper Gröup ☆"})
    views.add_language(request)