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))
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
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
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) )
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
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
def test_get_by_index_zero_index(self): tbl = HeaderTable() with pytest.raises(InvalidTableIndex): tbl.get_by_index(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)
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
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
def test_get_by_index_zero_index(self): tbl = HeaderTable() with pytest.raises(InvalidTableIndex): tbl.get_by_index(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)