def test_ProducerTable(): db = swsscommon.DBConnector("APPL_DB", 0, True) ps = swsscommon.ProducerTable(db, "abc") cs = swsscommon.ConsumerTable(db, "abc") fvs = swsscommon.FieldValuePairs([('a', 'b')]) ps.set("bbb", fvs) (key, op, cfvs) = cs.pop() assert key == "bbb" assert op == "SET" assert len(cfvs) == 1 assert cfvs[0] == ('a', 'b')
def test_ProducerTable(): db = swsscommon.DBConnector("APPL_DB", 0, True) ps = swsscommon.ProducerTable(db, "abc") cs = swsscommon.ConsumerTable(db, "abc") fvs = swsscommon.FieldValuePairs([('a', 'b'), ('c', 'd')]) ps.set("bbb", fvs) ps.delete("cccc") entries = transpose_pops(cs.pops()) assert len(entries) == 2 (key, op, cfvs) = entries[0] assert key == "bbb" assert op == "SET" assert len(cfvs) == 2 assert cfvs[0] == ('a', 'b') assert cfvs[1] == ('c', 'd') (key, op, cfvs) = entries[1] assert key == "cccc" assert op == "DEL" assert len(cfvs) == 0