Don't test exact equality of the list: as long as it has the fields we expect, that's just fine. I added the user_id (as in database pkey) and it broke: no point testing what that comes out as: it's determined by the db.

This commit is contained in:
David Baker 2015-03-24 18:21:54 +00:00
parent 9aa0224cdf
commit 438a21c87b

View File

@ -38,13 +38,12 @@ class RegistrationStoreTestCase(unittest.TestCase):
@defer.inlineCallbacks @defer.inlineCallbacks
def test_register(self): def test_register(self):
yield self.store.register(self.user_id, self.tokens[0], self.pwhash) yield self.store.register(self.user_id, self.tokens[0], self.pwhash)
u = yield self.store.get_user_by_id(self.user_id)[0]
self.assertEquals(
# TODO(paul): Surely this field should be 'user_id', not 'name' # TODO(paul): Surely this field should be 'user_id', not 'name'
# Additionally surely it shouldn't come in a 1-element list # Additionally surely it shouldn't come in a 1-element list
[{"name": self.user_id, "password_hash": self.pwhash}], self.assertEquals(self.user_id, u['name'])
(yield self.store.get_user_by_id(self.user_id)) self.assertEquals(self.pwhash, u['password_hash'])
)
self.assertEquals( self.assertEquals(
{"admin": 0, {"admin": 0,