def test_invalid_extension(service, user, token): data = { 'filename': 'file.bMp', 'content_type': 'image/jpeg', 'size': 500 * 1024, } res = service.post('/v1/upload', data, auth=token(user)) assert error(res, ValidationError)
def test_invalid_state(service, user, token, upload): upload1 = upload(user) upload2 = upload(user) data = { 'upload1': str(upload1.id), 'upload2': str(upload2.id), 'doc_type': 'PP', 'doc_country': 'AU', 'doc_state': '', } res = service.post('/v1/ids', data, auth=token(user)) assert error(res, InvalidState)
def test_create_package_missing_upload(service, user, token, upload): upload1 = upload(user) user.transition(INFO_VERIFIED) data = { 'upload1': str(upload1.id), 'upload2': str(ObjectId()), 'doc_type': 'PP', 'doc_country': 'AU', 'doc_state': None, } res = service.post('/v1/ids', data, auth=token(user)) assert error(res, ObjectNotFound)
def test_verify_invalid_image(service, user, token, upload): upload1 = upload(user) upload2 = upload(user) user.transition(INFO_VERIFIED) data = { 'upload1': str(upload1.id), 'upload2': str(upload2.id), 'doc_type': 'PP', 'doc_country': 'AU', 'doc_state': '', } with patch('upload.models.Upload.stored_size', 100): res = service.post('/v1/ids', data, auth=token(user)) assert error(res, ValidationError)
def test_whitelist_not_yet_opened(service): ts = datetime.datetime(2020, 10, 10) with patch('user.views.WHITELIST_OPEN_DATE', ts): res = service.post('/v1/user', new_user()) assert error(res, WhitelistClosed)
def test_closed_whitelist(service): with patch('user.views.WHITELIST_CLOSED', True): res = service.post('/v1/user', new_user()) assert error(res, WhitelistClosed)
def test_two_telegrams(service, user): res = service.post('/v1/user', new_user(telegram='telegram')) assert error(res, ObjectExists)
def test_invalid_telegram(service): res = service.post('/v1/user', new_user(telegram='no')) assert error(res, ValidationError)
def test_not_confirmed_location(service): res = service.post('/v1/user', new_user(confirmed_location=False)) assert error(res, ValidationError)
def test_try_using_existing_email(service, user): res = service.post( '/v1/user', new_user(email=user.email, eth_address='0x1111111111111111111111111111111111111111')) assert error(res, ObjectExists)
def test_try_using_existing_eth(service, user): res = service.post( '/v1/user', new_user(email='*****@*****.**', eth_address=user.eth_address)) assert error(res, ObjectExists)