예제 #1
0
파일: test_table.py 프로젝트: jayvdb/hpack
    def test_get_by_index_out_of_range(self):
        tbl = HeaderTable()
        off = len(HeaderTable.STATIC_TABLE)
        tbl.add(b'TestName', b'TestValue')
        with pytest.raises(InvalidTableIndex) as e:
            tbl.get_by_index(off + 2)

        assert ("Invalid table index %d" % (off + 2) in str(e.value))
예제 #2
0
 def test_get_by_index_static_table(self):
     tbl = HeaderTable()
     exp = (b':authority', b'')
     res = tbl.get_by_index(1)
     assert res == exp
     idx = len(HeaderTable.STATIC_TABLE)
     exp = (b'www-authenticate', b'')
     res = tbl.get_by_index(idx)
     assert res == exp
예제 #3
0
파일: test_table.py 프로젝트: irvind/hpack
 def test_get_by_index_static_table(self):
     tbl = HeaderTable()
     exp = (b':authority', b'')
     res = tbl.get_by_index(1)
     assert res == exp
     idx = len(HeaderTable.STATIC_TABLE)
     exp = (b'www-authenticate', b'')
     res = tbl.get_by_index(idx)
     assert res == exp
예제 #4
0
    def test_get_by_index_out_of_range(self):
        tbl = HeaderTable()
        off = len(HeaderTable.STATIC_TABLE)
        tbl.add(b'TestName', b'TestValue')
        with pytest.raises(InvalidTableIndex) as e:
            tbl.get_by_index(off + 2)

        assert (
            "InvalidTableIndex: Invalid table index %d" % (off + 2) in str(e)
        )
예제 #5
0
 def test_get_by_index_dynamic_table(self):
     tbl = HeaderTable()
     off = len(HeaderTable.STATIC_TABLE)
     val = (b'TestName', b'TestValue')
     tbl.add(*val)
     res = tbl.get_by_index(off + 1)
     assert res == val
예제 #6
0
파일: test_table.py 프로젝트: irvind/hpack
 def test_get_by_index_dynamic_table(self):
     tbl = HeaderTable()
     off = len(HeaderTable.STATIC_TABLE)
     val = (b'TestName', b'TestValue')
     tbl.add(*val)
     res = tbl.get_by_index(off + 1)
     assert res == val
예제 #7
0
 def test_get_by_index_zero_index(self):
     tbl = HeaderTable()
     with pytest.raises(InvalidTableIndex):
         tbl.get_by_index(0)
예제 #8
0
 def test_get_by_index_out_of_range(self):
     tbl = HeaderTable()
     off = len(HeaderTable.STATIC_TABLE)
     tbl.add(b'TestName', b'TestValue')
     with pytest.raises(InvalidTableIndex):
         tbl.get_by_index(off + 2)
예제 #9
0
파일: test_table.py 프로젝트: irvind/hpack
 def test_get_by_index_out_of_range(self):
     tbl = HeaderTable()
     off = len(HeaderTable.STATIC_TABLE)
     tbl.add(b'TestName', b'TestValue')
     res = tbl.get_by_index(off+2)
     assert res is None # TODO HPACKException will be raised instead
예제 #10
0
파일: test_table.py 프로젝트: irvind/hpack
 def test_get_by_index_zero_index(self):
     tbl = HeaderTable()
     res = tbl.get_by_index(0)
     assert res is None # TODO HPACKException will be raised instead
예제 #11
0
 def test_get_by_index_zero_index(self):
     tbl = HeaderTable()
     with pytest.raises(InvalidTableIndex):
         tbl.get_by_index(0)
예제 #12
0
 def test_get_by_index_out_of_range(self):
     tbl = HeaderTable()
     off = len(HeaderTable.STATIC_TABLE)
     tbl.add(b'TestName', b'TestValue')
     with pytest.raises(InvalidTableIndex):
         res = tbl.get_by_index(off+2)