3 hours, 44 minutes, and 33 seconds | ||
dalba | 5749b75 Changeset → | |
login.py: Unpack entry instead of overwriting itself - Open the password file in a with block to make sure it is always closed properly. - login_tests.py was mocking `codecs.open` and the returned object was not a context manager; therefore did not work with our new `with` statement. Use `io.StringIO` to make it work again. - Unpack `entry` into variables. This makes the code easier to follow and developers won't need to remember what each entry item means when examining the code. - Fix a minor bug in file line numbers. Line numbers start from 1, not 0. Reverse the order of reading lines, so that we can break the password search loop as soon as we find a matching password entry. This way the priority of password entries won't change. Change-Id: Ide50f0fd7d1baaa875907a17ed1e25801b6d472a |