def test_filter_not_good_message(self): model.db_connect() user1 = User(jid="*****@*****.**") account11 = ExampleAccount(user=user1, name="account11", jid="*****@*****.**") account11.waiting_password_reply = True account12 = ExampleAccount(user=user1, name="account12", jid="*****@*****.**") message = Message(from_jid="*****@*****.**", to_jid="*****@*****.**", subject="[WRONG MESSAGE]", body="secret") _account = self.handler.filter(message, None) self.assertEquals(_account, None) model.db_disconnect()
def test_filter_waiting_password(self): model.db_connect() user1 = User(jid="*****@*****.**") account11 = ExampleAccount(user=user1, name="account11", jid="*****@*****.**") account11.waiting_password_reply = True account12 = ExampleAccount(user=user1, name="account12", jid="*****@*****.**") message = Message(from_jid="[email protected]/resource", to_jid="*****@*****.**", subject="[PASSWORD]", body="secret") _account = self.handler.filter(message, None) self.assertEquals(_account.name, "account11") model.db_disconnect()