def test_sign_up():
    xid = str(time.strftime("%m%d%s"))
    headers = {'content-type': 'application/x-www-form-urlencoded'}
    exerciser_registration_params = {'locale':'en-US',
        'gender':'M',
        'measurementUnit':'M',
        'homeClubUuid':'9fbd8609-7f4c-480c-abd6-087899b9bd88',
        'passcode': 1234,
        'confirmPasscode': 1234,
        'email': str(xid) + '*****@*****.**',
        'firstname': 'John',
        'lastname': 'Galt',
        'clientLoginId': xid}

    s = requests.Session()
    r = s.post(url=login.getHost() + config.exerciser_registration_url, data=exerciser_registration_params,
        headers=headers)

    print '\n '\


    print r.json()

    assert r.status_code == 200
    assert 'uuid' in r.json()
    assert r.json()['verified'] == False
    assert r.json()['roles'] == ['Exerciser']
    assert r.json()['homeClubUuid'] == '9fbd8609-7f4c-480c-abd6-087899b9bd88'
    assert r.json()['barcode'] == None
    assert r.json()['memberId'] == None
    assert r.json()['membershipType'] == None
    assert r.json()['measurementUnit'] == 'M'
    assert r.json()['role'] == 'Exerciser'
    assert r.json()['timezone'] == 'US/Eastern'
    assert r.json()['xid'] == str(xid)
    assert r.json()['nickname'] == None
__author__ = 'vdeineko'

import requests
import login
import config
import pytest
import json

url = login.getHost()
url_with_uuid = config.get_challenge_list_with_user_uuid
url_without_uuid = config.get_challenge_list_with_end_date
start_from = '2015-03-03'
end_by = '2015-05-03'

s = requests.Session()
uuid = login.makeLogin(s)['uuid']


def test_correct_challenge_error():
        r = s.get(url + url_without_uuid%(end_by,start_from))
        assert r.status_code == 400
        response = r.json()
        assert response["errors"] == {"startFrom":"invalidDateRange"}


def test_incorrect_challenge_error():
        r = s.get(url+ url_with_uuid%(uuid,end_by,start_from))
        assert r.status_code == 400
        response = r.json()
        assert response["errors"] == {"startFrom":"invalidDateRange"}