示例#1
0
    def test_it_should_return_missing_if_not_present(self):
        query = []
        request = make_form_request(query)

        result = parser.parse_form(request)

        assert result == {}
示例#2
0
    def test_it_should_return_empty_list_if_multiple_and_not_present(self):
        query = []
        request = make_form_request(query)

        result = parser.parse_form(request)

        assert result == {}
示例#3
0
    def test_it_should_get_multiple_values(self):
        query = [(name, value), (name, value)]
        arg = Arg(multiple=True)
        request = make_form_request(query)

        result = parser.parse_form(request, name, arg)

        assert result == [bvalue, bvalue]
示例#4
0
    def test_it_should_return_empty_list_if_multiple_and_not_present(self):
        query = []
        arg = Arg(multiple=True)
        request = make_form_request(query)

        result = parser.parse_form(request, name, arg)

        assert result is Missing
示例#5
0
    def test_it_should_return_missing_if_not_present(self):
        query = []
        arg = Arg(multiple=False)
        request = make_form_request(query)

        result = parser.parse_form(request, name, arg)

        assert result is Missing
示例#6
0
    def test_it_should_get_multiple_values(self):
        query = [(name, value), (name, value)]
        field = fields.List(fields.Field())
        request = make_form_request(query)

        result = parser.parse_form(request, name, field)

        assert result == [value, value]
示例#7
0
    def test_it_should_get_single_values(self):
        query = [(name, value)]
        field = fields.Field()
        request = make_form_request(query)

        result = parser.parse_form(request, name, field)

        assert result == value
示例#8
0
    def test_it_should_return_empty_list_if_multiple_and_not_present(self):
        query = []
        field = fields.List(fields.Field())
        request = make_form_request(query)

        result = parser.parse_form(request, name, field)

        assert result is missing
示例#9
0
    def test_it_should_return_missing_if_not_present(self):
        query = []
        field = fields.Field()
        request = make_form_request(query)

        result = parser.parse_form(request, name, field)

        assert result is missing
示例#10
0
    def test_it_should_return_empty_list_if_multiple_and_not_present(self):
        query = []
        arg = Arg(multiple=True)
        request = make_form_request(query)

        result = parser.parse_form(request, name, arg)

        assert result == []
示例#11
0
    def test_it_should_return_none_if_not_present(self):
        query = []
        arg = Arg(multiple=False)
        request = make_form_request(query)

        result = parser.parse_form(request, name, arg)

        assert result == None
示例#12
0
    def test_it_should_get_multiple_values(self):
        query = [(name, value), (name, value)]
        arg = Arg(multiple=True)
        request = make_form_request(query)

        result = parser.parse_form(request, name, arg)

        assert result == [bvalue, bvalue]