Beispiel #1
0
def add_user():
    Utility.load_evironment()
    connect(Utility.environment["mongo_db"],
            host=Utility.environment["mongo_url"])
    account = AccountProcessor.add_account("integration", "testAdmin")
    bot = AccountProcessor.add_bot("integration", account["_id"], "testAdmin")
    AccountProcessor.add_user(
        email="*****@*****.**",
        first_name="Demo",
        last_name="User",
        password="******",
        account=account["_id"],
        bot=bot["name"],
        user="******",
    )

    account = AccountProcessor.add_account("integration2", "testAdmin")
    bot = AccountProcessor.add_bot("integration2", account["_id"], "testAdmin")
    AccountProcessor.add_user(
        email="*****@*****.**",
        first_name="Demo",
        last_name="User",
        password="******",
        account=account["_id"],
        bot=bot["name"],
        user="******",
    )
Beispiel #2
0
 def test_get_user_details_user_inactive(self):
     account = AccountProcessor.add_account("paytm", "testAdmin")
     bot = AccountProcessor.add_bot("support", account["_id"], "testAdmin")
     user = AccountProcessor.add_user(
         email="*****@*****.**",
         first_name="Demo",
         last_name="User",
         password="******",
         account=account["_id"],
         bot=bot["name"],
         user="******",
     )
     user_details = AccountProcessor.get_user_details(user["email"])
     assert all(user_details[key] == False if key ==
                "is_integration_user" else user_details[key]
                for key in user_details.keys())
     user_details = User.objects().get(id=user["_id"])
     user_details.status = False
     user_details.save()
     with pytest.raises(Exception):
         user_details = AccountProcessor.get_user_details(
             user_details["email"])
         assert all(user_details[key] == False if key ==
                    "is_integration_user" else user_details[key]
                    for key in user_details.keys())
     user_details.status = True
     user_details.save()
Beispiel #3
0
 def test_add_none_bot(self):
     with pytest.raises(ValidationError):
         AccountProcessor.add_bot(None, 1, "testAdmin")
Beispiel #4
0
 def test_add_empty_bot(self):
     with pytest.raises(ValidationError):
         AccountProcessor.add_bot("", 1, "testAdmin")
Beispiel #5
0
 def test_add_duplicate_bot(self):
     with pytest.raises(Exception):
         AccountProcessor.add_bot("test", 1, "testAdmin")
Beispiel #6
0
 def test_add_bot(self):
     bot = AccountProcessor.add_bot("test", 1, "testAdmin")
     assert bot
Beispiel #7
0
 def test_add_bot(self):
     bot = AccountProcessor.add_bot("test", 1, "testAdmin")
     assert bot
     pytest.bot = bot['_id'].__str__()
Beispiel #8
0
 def test_add_blank_bot(self):
     with pytest.raises(AssertionError):
         AccountProcessor.add_bot(" ", 1, "testAdmin")
Beispiel #9
0
 def test_add_duplicate_bot_case_insensitive(self):
     with pytest.raises(Exception):
         AccountProcessor.add_bot("TEST", 1, "testAdmin")
Beispiel #10
0
 def test_add_bot(self):
     bot_response = AccountProcessor.add_bot("test", 1, "testAdmin")
     assert bot_response
     pytest.bot = bot_response["_id"].__str__()