Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 46 lines (35 sloc) 1.093 kB
5162175 @adelevie adding very *limited* support for User.
authored
1 require 'helper'
2
3 class TestUser < Test::Unit::TestCase
4
5 def setup
6 Parse.init
7 end
8
58b7da6 @adelevie using VCR for most tests
authored
9 def test_user_save
10 VCR.use_cassette('test_user_save', :record => :new_episodes) do
11 username = rand.to_s
12 data = {
13 :username => username,
14 :password => "topsecret"
15 }
16 user = Parse::User.new data
17 user.save
18 assert_equal user[Parse::Protocol::KEY_OBJECT_ID].class, String
19 assert_equal user[Parse::Protocol::KEY_CREATED_AT].class, String
20 end
5162175 @adelevie adding very *limited* support for User.
authored
21 end
22
58b7da6 @adelevie using VCR for most tests
authored
23 def test_user_login
24 #VCR.use_cassette('test_user_login', :record => :new_episodes) do
25 u = "alan" + rand(10000000000000).to_s
26 data = {
27 :username => u,
28 :password => "secret"
29 }
20e1192 @adelevie fixed User::authenticate
authored
30
58b7da6 @adelevie using VCR for most tests
authored
31 user = Parse::User.new(data)
20e1192 @adelevie fixed User::authenticate
authored
32
58b7da6 @adelevie using VCR for most tests
authored
33 user.save
34
35 assert_equal user["username"], u
36 assert_equal user[Parse::Protocol::KEY_USER_SESSION_TOKEN].class, String
37
38 login = Parse::User.authenticate(u, "secret")
39
40 assert_equal login["username"], user["username"]
41 assert_equal login["sessionToken"].class, String
42 #end
5162175 @adelevie adding very *limited* support for User.
authored
43 end
44
45 end
Something went wrong with that request. Please try again.