Example #1
0
    def test_create(self, *args, **kwargs):
        create()

        self.assertTrue(BaseUser.exists().where(
            (BaseUser.admin == True)  # noqa: E712
            & (BaseUser.username == "bob123")
            & (BaseUser.email == "*****@*****.**")).run_sync())
Example #2
0
    def test_create_with_arguments(self, *args, **kwargs):
        arguments = {
            "username": "******",
            "email": "*****@*****.**",
            "password": "******",
            "is_admin": True,
            "is_superuser": True,
            "is_active": True,
        }
        create(**arguments)

        self.assertTrue(
            BaseUser.exists().where((BaseUser.admin == True)  # noqa: E712
                                    & (BaseUser.username == "bob123")
                                    & (BaseUser.email == "*****@*****.**")
                                    & (BaseUser.superuser.eq(True))
                                    & (BaseUser.active.eq(True))).run_sync())
 def test_superuser(self):
     run_sync(change_permissions(username="******", superuser=True))
     self.assertTrue(
         BaseUser.exists().where(BaseUser.username == "bob",
                                 BaseUser.superuser.eq(True)).run_sync())
 def test_active(self):
     run_sync(change_permissions(username="******", active=True))
     self.assertTrue(BaseUser.exists().where(
         BaseUser.username == "bob", BaseUser.active.eq(True)).run_sync())