def test_compare_create(self): key = 'key' tx = etcd3.Transactions() create_compare = tx.create(key) == 10 assert create_compare.op == etcdrpc.Compare.EQUAL create_compare = tx.create(key) < 155 assert create_compare.op == etcdrpc.Compare.LESS create_compare = tx.create(key) > -12 assert create_compare.op == etcdrpc.Compare.GREATER assert create_compare.build_message().target == etcdrpc.Compare.CREATE
def test_compare_value(self): key = 'key' tx = etcd3.Transactions() value_compare = tx.value(key) == 'b' assert value_compare.op == etcdrpc.Compare.EQUAL value_compare = tx.value(key) < 'b' assert value_compare.op == etcdrpc.Compare.LESS value_compare = tx.value(key) > 'b' assert value_compare.op == etcdrpc.Compare.GREATER assert value_compare.build_message().target == etcdrpc.Compare.VALUE
def test_compare_mod(self): key = 'key' tx = etcd3.Transactions() mod_compare = tx.mod(key) == -100 assert mod_compare.op == etcdrpc.Compare.EQUAL mod_compare = tx.mod(key) < 19 assert mod_compare.op == etcdrpc.Compare.LESS mod_compare = tx.mod(key) > 21 assert mod_compare.op == etcdrpc.Compare.GREATER assert mod_compare.build_message().target == etcdrpc.Compare.MOD
def test_compare_version(self): key = 'key' tx = etcd3.Transactions() version_compare = tx.version(key) == 1 assert version_compare.op == etcdrpc.Compare.EQUAL version_compare = tx.version(key) < 91 assert version_compare.op == etcdrpc.Compare.LESS version_compare = tx.version(key) > 92 assert version_compare.op == etcdrpc.Compare.GREATER assert version_compare.build_message().target == \ etcdrpc.Compare.VERSION