def test_load_with_empty_file(self): Users.users = {} Users.load() self.assertIsNotNone(Users.first()) first_user = Users.first() self.assertEqual(first_user.id, _DEFAULT_USER) self.assertEqual(first_user.password, _DEFAULT_PASSWORD)
def test_load(self): conf_file = 'conf/users.conf' conf_content = """id|password user1|pwd1 user2|pwd2 # comment user3|pwd3 """ self.fs.create_file(conf_file, contents=conf_content) Users.users = {} Users.load() self.assertIsNotNone(Users.first()) first_user = Users.first() self.assertEqual(first_user.id, 'user1') self.assertEqual(first_user.password, 'pwd1') self.fs.remove(conf_file)