Class: TestUsers

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/v2/test/test_users.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



21
22
23
# File 'lib/v2/test/test_users.rb', line 21

def setup
  # do nothing
end

#teardownObject



49
50
51
# File 'lib/v2/test/test_users.rb', line 49

def teardown
  # do nothing
end

#test_usersObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/v2/test/test_users.rb', line 25

def test_users
  print '> input your Pushbullet access token: '
  input = STDIN.noecho(&:gets)

  assert_not_nil(input)
  access_token = input.chomp
  
  Pushbullet.set_access_token(access_token)

  # my info
  info = Pushbullet::V2::Users.me
  assert_not_nil(info)

  # update my preference
  test_flag = 'test_flag'
  test_value = 'this is a flag for testing'
  updated = Pushbullet::V2::Users.update_my_preferences({test_flag => test_value})
  assert_not_nil(updated)
  assert_equal(updated['preferences'][test_flag], test_value)

  # rollback my preference
  assert_not_nil(Pushbullet::V2::Users.update_my_preferences(info['preferences']))
end