コード例 #1
0
    def test_4(self, request_type, resource_path, protocol_type):
        instance = app10.reqstr2obj(
            f"{request_type} {resource_path} {protocol_type}")

        assert instance.request_type == request_type
        assert instance.resource_path == resource_path
        assert instance.protocol_type == protocol_type
コード例 #2
0
    def test_1(self):
        with pytest.raises(TypeError):
            app10.reqstr2obj(123)

        with pytest.raises(TypeError):
            app10.reqstr2obj([])
コード例 #3
0
 def test_8(self, request_str):
     with pytest.raises(ValueError):
         app10.reqstr2obj(request_str)
コード例 #4
0
 def test_7(self, request_str):
     with pytest.raises(BadHTTPVersion):
         app10.reqstr2obj(request_str)
コード例 #5
0
 def test_6(self, request_str):
     with pytest.raises(BadRequestTypeError):
         app10.reqstr2obj(request_str)
コード例 #6
0
    def test_5(self, request_str):
        instance = app10.reqstr2obj(request_str)

        assert instance is None
コード例 #7
0
    def test_3(self):
        instance = app10.reqstr2obj("GET / HTTP1.1")

        assert instance.request_type == "GET"
        assert instance.resource_path == "/"
        assert instance.protocol_type == "HTTP1.1"
コード例 #8
0
    def test_2(self):
        instance = app10.reqstr2obj("GET / HTTP1.1")

        assert type(instance) == MyHttpRequest