From 79f5efd4687224519cd22b98b4f37b2832b1aae5 Mon Sep 17 00:00:00 2001 From: Ji-Wei Date: Thu, 14 Jul 2016 16:58:43 +0800 Subject: [PATCH] Class Credentials not define __ne__() built-in function Class Credentials defines __eq__() built-in function, but does not define __ne__() built-in function, so self.assertEqual works but self.assertNotEqual does not work at all in this test case in python2. This patch fixes it. Change-Id: I2c0d9d6202d64de57700ceb7c15db8ed3ad7e8ff Closes-Bug: #1586268 --- tempest/lib/auth.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tempest/lib/auth.py b/tempest/lib/auth.py index 1857a438b8..83aa405f3f 100644 --- a/tempest/lib/auth.py +++ b/tempest/lib/auth.py @@ -689,6 +689,10 @@ class Credentials(object): """Credentials are equal if attributes in self.ATTRIBUTES are equal""" return str(self) == str(other) + def __ne__(self, other): + """Contrary to the __eq__""" + return not self.__eq__(other) + def __getattr__(self, key): # If an attribute is set, __getattr__ is not invoked # If an attribute is not set, and it is a known one, return None