# Path: pushmanager/testing/mocksettings.py



from contextlib import nested
from pushmanager.core.settings import Settings
from pushmanager.handlers import LoginHandler
from pushmanager.testing.mocksettings import MockedSettings
from pushmanager.testing.testservlet import ServletTestMixin
import mock
import logging
import urllib
import testify as T
            "password": "fake_password"
        }
        MockedSettings['login_strategy'] = ''
        with nested(mock.patch.object(logging, "exception"),
                    mock.patch.dict(Settings, MockedSettings)):

            response = self.fetch(
                "/login",
                method="POST",
                body=urllib.urlencode(request)
            )
            T.assert_in("No login strategy currently configured.", response.body)

    def test_ldap_login_post(self):
        request = {
            "username": "fake_username",
            "password": "fake_password"
        }
        MockedSettings['login_strategy'] = 'ldap'
        with nested(mock.patch.object(logging, "exception"),
                    mock.patch.dict(Settings, MockedSettings)):

            response = self.fetch(
                "/login",
                method="POST",
                body=urllib.urlencode(request)
            )
            T.assert_in("Invalid username or password specified.", response.body)

    def test_saml_login_post(self):

# Path: pushmanager/testing/mocksettings.py



# Path: pushmanager/tests/test_servlet_login.py
from contextlib import nested
from pushmanager.core.settings import Settings
from pushmanager.handlers import LoginHandler
from pushmanager.testing.mocksettings import MockedSettings
from pushmanager.testing.testservlet import ServletTestMixin
import mock
import logging
import urllib
import testify as T

            "password": "fake_password"
        }
        MockedSettings['login_strategy'] = ''
        with nested(mock.patch.object(logging, "exception"),
                    mock.patch.dict(Settings, MockedSettings)):

            response = self.fetch(
                "/login",
                method="POST",
                body=urllib.urlencode(request)
            )
            T.assert_in("No login strategy currently configured.", response.body)

    def test_ldap_login_post(self):
        request = {
            "username": "fake_username",
            "password": "fake_password"
        }
        MockedSettings['login_strategy'] = 'ldap'
        with nested(mock.patch.object(logging, "exception"),
                    mock.patch.dict(Settings, MockedSettings)):

            response = self.fetch(
                "/login",
                method="POST",
                body=urllib.urlencode(request)
            )
            T.assert_in("Invalid username or password specified.", response.body)

    def test_saml_login_post(self):

        MockedSettings['login_strategy'] = 'saml'