Пример #1
0
    def test_add_strips_spaces(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "   eva   ",
            "authority": "     foo.org   "
        }

        staff_add(pyramid_request)

        assert users['eva'].staff
Пример #2
0
    def test_add_is_idempotent(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "agnos",
            "authority": pyramid_request.authority
        }

        staff_add(pyramid_request)

        assert users['agnos'].staff
Пример #3
0
    def test_add_strips_spaces(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "   eva   ",
            "authority": "     foo.org   "
        }

        staff_add(pyramid_request)

        assert users['eva'].staff
Пример #4
0
    def test_add_is_idempotent(self, pyramid_request, users):
        pyramid_request.params = {
            "add": "agnos",
            "authority": pyramid_request.authority
        }

        staff_add(pyramid_request)

        assert users['agnos'].staff
Пример #5
0
    def test_add_flashes_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {
            "add": "florp",
            "authority": pyramid_request.authority
        }
        pyramid_request.session.flash = mock.Mock()

        staff_add(pyramid_request)

        assert pyramid_request.session.flash.call_count == 1
Пример #6
0
    def test_add_flashes_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {
            "add": "florp",
            "authority": pyramid_request.authority
        }
        pyramid_request.session.flash = mock.Mock()

        staff_add(pyramid_request)

        assert pyramid_request.session.flash.call_count == 1
Пример #7
0
    def test_add_redirects_to_index_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {
            "add": "florp",
            "authority": pyramid_request.authority
        }

        result = staff_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/staff'
Пример #8
0
    def test_add_redirects_to_index_when_user_not_found(self, pyramid_request):
        pyramid_request.params = {
            "add": "florp",
            "authority": pyramid_request.authority
        }

        result = staff_add(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
        assert result.location == '/adm/staff'