Example #1
0
    def setup_func():
        leancloud.client.USE_MASTER_KEY = None
        leancloud.client.APP_ID = None
        leancloud.client.APP_KEY = None
        leancloud.client.MASTER_KEY = None
        leancloud.init(
            os.environ['APP_ID'],
            app_key=os.environ['APP_KEY'],
            master_key=os.environ['MASTER_KEY']
        )
        users = Query(User).find()
        for u in users:
            u.destroy()

        user1 = User()
        user1.set('username', 'user1_name')
        user1.set('password', 'password')
        user1.set_email('*****@*****.**')
        user1.set_mobile_phone_number('18611111111')
        user1.sign_up()
        user1.logout()

        user2 = User()
        user2.set('username', 'user2_name')
        user2.set('password', 'password')
        user2.sign_up()
        user2.logout()
        leancloud.client.use_master_key(use_master_key)
Example #2
0
    def setup_func():
        leancloud.client.USE_MASTER_KEY = None
        leancloud.client.APP_ID = None
        leancloud.client.APP_KEY = None
        leancloud.client.MASTER_KEY = None
        leancloud.init(os.environ['APP_ID'],
                       app_key=os.environ['APP_KEY'],
                       master_key=os.environ['MASTER_KEY'])
        users = Query(User).find()
        for u in users:
            u.destroy()

        user1 = User()
        user1.set('username', 'user1_name')
        user1.set('password', 'password')
        user1.set_email('*****@*****.**')
        user1.set_mobile_phone_number('18611111111')
        user1.sign_up()
        user1.logout()

        user2 = User()
        user2.set('username', 'user2_name')
        user2.set('password', 'password')
        user2.sign_up()
        user2.logout()
        leancloud.client.use_master_key(use_master_key)
Example #3
0
    def setup_func():
        leancloud.client.USE_MASTER_KEY = None
        leancloud.client.APP_ID = None
        leancloud.client.APP_KEY = None
        leancloud.client.MASTER_KEY = None
        leancloud.init(
            os.environ["APP_ID"],
            app_key=os.environ["APP_KEY"],
            master_key=os.environ["MASTER_KEY"],
        )
        users = Query(User).find()
        for u in users:
            u.destroy()

        user1 = User()
        user1.set("username", "user1_name")
        user1.set("password", "password")
        user1.set_email("*****@*****.**")
        user1.set_mobile_phone_number("18611111111")
        user1.sign_up()
        user1.logout()

        user2 = User()
        user2.set("username", "user2_name")
        user2.set("password", "password")
        user2.sign_up()
        user2.logout()
        leancloud.client.use_master_key(use_master_key)
Example #4
0
def test_request_change_phone_number():  # type: () -> None
    user1 = User()
    user1.set("username", "py_test_change_phone")
    user1.set("password", "password")
    user1.sign_up()
    try:
        # phone number is from http://www.z-sms.com
        User.request_change_phone_number("+8617180655340")
    except LeanCloudError as e:
        if e.code not in (119, 213, 601, 605):
            raise e
    finally:
        user1.logout()
Example #5
0
def test_sign_out():
    user = User()
    user.sign_up('Musen', 'password')
    user.logout()
    assert not user.is_current
Example #6
0
def test_sign_out():
    user = User()
    user.sign_up('Musen', 'password')
    user.logout()
    assert not user.is_current
Example #7
0
def test_sign_out():  # type: () -> None
    user = User()
    user.sign_up("Musen", "password")
    user.logout()
    assert not user.is_current