Skip to content

Commit

Permalink
test: make file_test stateless
Browse files Browse the repository at this point in the history
Previously file_test requires there is already a specific existing user
in the application. This commit removes this requirement.

see also leancloud#439
  • Loading branch information
weakish committed Dec 24, 2019
1 parent af8f565 commit af8397f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from nose.tools import raises # type: ignore

import leancloud
from leancloud import File
from leancloud import File, LeanCloudError
from leancloud import ACL

__author__ = 'asaka'
Expand Down Expand Up @@ -73,7 +73,16 @@ def test_acl(): # type: () -> None
@with_setup(setup_func)
def test_save(): # type: () -> None
user = leancloud.User()
user.login('user1_name', 'password')
name = 'user1_name'
passwd = 'password'
try:
user.login(name, passwd)
except LeanCloudError as e:
if e.code == 211:
user.set_username(name)
user.set_password(passwd)
user.sign_up()
user.login(name, passwd)

f = File('Blah.txt', open('tests/sample_text.txt', 'rb'))
f.save()
Expand Down

0 comments on commit af8397f

Please sign in to comment.