Monday, May 29, 2017

[389-commits] [lib389] 01/01: Issue 27 - Fix get function in tests

This is an automated email from the git hooks/post-receive script.

spichugi pushed a commit to branch master
in repository lib389.

commit f32a14b1f89641fb6a566e43fc338becc728cd5b
Author: Simon Pichugin <spichugi@redhat.com>
Date: Sun May 28 22:52:57 2017 +0200

Issue 27 - Fix get function in tests

Description: Function 'dseldif.get' now returns None,
if we haven't found an attribute. Fix tests accordingly.

https://pagure.io/lib389/issue/27

Reviewed by: wibrown (Thanks!)
---
lib389/tests/dseldif_test.py | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib389/tests/dseldif_test.py b/lib389/tests/dseldif_test.py
index 25eef77..44eb4d4 100644
--- a/lib389/tests/dseldif_test.py
+++ b/lib389/tests/dseldif_test.py
@@ -34,6 +34,10 @@ def test_get_singlevalue(topo, entry_dn):
attr_values = dse_ldif.get(entry_dn, "cn")
assert attr_values == ["config"]

+ log.info("Get 'nonexistent' attr from {}".format(entry_dn))
+ attr_values = dse_ldif.get(entry_dn, "nonexistent")
+ assert not attr_values
+

def test_get_multivalue(topo):
"""Check that we can get attribute values"""
@@ -63,8 +67,7 @@ def test_add(topo, fake_attr_value):

log.info("Clean up")
dse_ldif.delete(DN_CONFIG, fake_attr)
- with pytest.raises(ValueError):
- dse_ldif.get(DN_CONFIG, fake_attr)
+ assert not dse_ldif.get(DN_CONFIG, fake_attr)


def test_replace(topo):
@@ -107,8 +110,7 @@ def test_delete_singlevalue(topo):

log.info("Clean up")
dse_ldif.delete(DN_CONFIG, fake_attr)
- with pytest.raises(ValueError):
- dse_ldif.get(DN_CONFIG, fake_attr)
+ assert not dse_ldif.get(DN_CONFIG, fake_attr)


def test_delete_multivalue(topo):
@@ -124,6 +126,5 @@ def test_delete_multivalue(topo):

log.info("Delete all values of {}".format(fake_attr))
dse_ldif.delete(DN_CONFIG, fake_attr)
- with pytest.raises(ValueError):
- dse_ldif.get(DN_CONFIG, fake_attr)
+ assert not dse_ldif.get(DN_CONFIG, fake_attr)


--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
389-commits mailing list -- 389-commits@lists.fedoraproject.org
To unsubscribe send an email to 389-commits-leave@lists.fedoraproject.org

No comments:

Post a Comment