def test_from_userpass_pair(credentials): expected = ( b'\x0b\xee\xc7\xb5\xea?\x0f\xdb\xc9]\r\xd4\x7f<[\xc2u\xda\x8a3' + b'|T8\xa2\xd5\xa6\xf1\x08\xb6%\x82\x15\x9d\xbc\xbd\xb7g\x17\xa0\xfc' + b'\x00\x00') user_data = UserData.from_userpass_pair(*credentials) assert user_data.key == expected
def test_create_key(api): username = '******' password = '******' key = UserData.from_userpass_pair(username, password, api.get_cluster_uuid()).key key = key[20:40].encode('hex') assert core.create_key(username, password) == key
def create_key(email, password): """Convert given data to a sx-usable auth key.""" uuid = api.get_cluster_uuid() key = UserData.from_userpass_pair(email, password, uuid).key return key[20:40].encode('hex') # Return private part only