class TestUsers

Public Instance Methods

setup() click to toggle source
# File lib/v2/test/test_users.rb, line 21
def setup
  # do nothing
end
teardown() click to toggle source
# File lib/v2/test/test_users.rb, line 49
def teardown
  # do nothing
end
test_users() click to toggle source
# 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