def test_add_user_None_password(self):
     with pytest.raises(AppException):
         AccountProcessor.add_user(
             email="*****@*****.**",
             first_name="Fahad Ali",
             last_name="Shaikh",
             password=None,
             account=1,
             bot=pytest.bot,
             user="******",
         )
 def test_add_user_blank_lastname(self):
     with pytest.raises(AppException):
         AccountProcessor.add_user(
             email="*****@*****.**",
             first_name="Fahad Ali",
             last_name=" ",
             password="******",
             account=1,
             bot=pytest.bot,
             user="******",
         )
 def test_add_user_none_email(self):
     with pytest.raises(AppException):
         AccountProcessor.add_user(
             email=None,
             first_name="Fahad Ali",
             last_name="Shaikh",
             password="******",
             account=1,
             bot=pytest.bot,
             user="******",
         )
 def test_add_user_invalid_email(self):
     with pytest.raises(ValidationError):
         AccountProcessor.add_user(
             email="demo",
             first_name="Fahad Ali",
             last_name="Shaikh",
             password="******",
             account=1,
             bot=pytest.bot,
             user="******",
         )
 def test_add_user_duplicate_case_insensitive(self):
     with pytest.raises(Exception):
         AccountProcessor.add_user(
             email="*****@*****.**",
             first_name="Fahad Ali",
             last_name="Shaikh",
             password="******",
             account=1,
             bot=pytest.bot,
             user="******",
         )
 def test_new_user_confirm(self, monkeypatch):
     AccountProcessor.add_user(
         email="*****@*****.**",
         first_name="inteq",
         last_name="2",
         password='******',
         account=1,
         bot=pytest.bot,
         user="******",
     )
     monkeypatch.setattr(Utility, 'trigger_smtp', self.mock_smtp)
     token = Utility.generate_token('*****@*****.**')
     loop = asyncio.new_event_loop()
     loop.run_until_complete(AccountProcessor.confirm_email(token))
     assert True
 def test_send_confirmation_link_with_valid_id(self, monkeypatch):
     AccountProcessor.add_user(
         email="*****@*****.**",
         first_name="inteq",
         last_name="3",
         password='******',
         account=1,
         bot=pytest.bot,
         user="******",
     )
     AccountProcessor.EMAIL_ENABLED = True
     monkeypatch.setattr(Utility, 'trigger_smtp', self.mock_smtp)
     loop = asyncio.new_event_loop()
     loop.run_until_complete(
         AccountProcessor.send_confirmation_link('*****@*****.**'))
     AccountProcessor.EMAIL_ENABLED = False
     assert True
 def test_add_user(self):
     user = AccountProcessor.add_user(
         email="*****@*****.**",
         first_name="Fahad Ali",
         last_name="Shaikh",
         password="******",
         account=1,
         bot=pytest.bot,
         user="******",
     )
     assert user
     assert user["password"] != "12345"
     assert user["status"]