コード例 #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
ファイル: test_table.py プロジェクト: Coder206/servo
    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
ファイル: test_table.py プロジェクト: Coder206/servo
 def test_get_by_index_zero_index(self):
     tbl = HeaderTable()
     with pytest.raises(InvalidTableIndex):
         tbl.get_by_index(0)
コード例 #12
0
ファイル: test_table.py プロジェクト: Stranger6667/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):
         res = tbl.get_by_index(off+2)