test/access/member_test.rb in access-2.0.36 vs test/access/member_test.rb in access-2.0.37

- old
+ new

@@ -1,112 +1,33 @@ require './test/test_helper' class MemberTest < Minitest::Test - def test_register_success - VCR.use_cassette('member register success') do - request = Access::Member.register registration_params.merge(api_environment: 'stage') - assert request.success - assert_kind_of Access::MemberResponse, request - assert_kind_of Array, request.users - assert_equal 1, request.users.count - assert_kind_of Access::Member, request.users.first - end - end - - def test_register_failure - VCR.use_cassette('member register failure') do - request = Access::Member.register registration_params.merge(email: nil, api_environment: 'stage') - refute request.success - assert_equal 400, request.status - assert_kind_of Access::MemberResponse, request - refute_nil request.error - assert_kind_of Access::Error, request.error - end - end - - def test_authenticate_success - VCR.use_cassette('member authenticate success') do - request = Access::Member.authenticate email: 'ben@test.com', password: 'password', api_environment: 'stage' - assert request.success - assert_kind_of Access::MemberResponse, request - assert_kind_of Array, request.users - assert_equal 1, request.users.count - assert_kind_of Access::Member, request.users.first - end - end - - def test_authenticate_failure - VCR.use_cassette('member authenticate failure') do - request = Access::Member.authenticate email: 'ben@test.com', password: 'bad', api_environment: 'stage' - refute request.success - assert_equal 401, request.status - assert_kind_of Access::MemberResponse, request - refute_nil request.error - assert_kind_of Access::Error, request.error - end - end - - def test_authenticate_cvt_success - VCR.use_cassette('member authenticate cvt success') do - request = Access::Member.authenticate_by_cvt cvt: '6fa6c66c4edc07b767f147a6e5fc614c20797ef0', api_environment: 'stage' - assert request.success - assert_kind_of Access::MemberResponse, request - assert_kind_of Array, request.users - assert_equal 1, request.users.count - assert_kind_of Access::Member, request.users.first - end - end - - def test_authenticate_cvt_failure - VCR.use_cassette('member authenticate cvt failure') do - request = Access::Member.authenticate_by_cvt cvt: 'thisisaverybadcvtman1234556badbadbad', api_environment: 'stage' - refute request.success - assert_equal 401, request.status - assert_kind_of Access::MemberResponse, request - refute_nil request.error - assert_kind_of Access::Error, request.error - end - end - def test_member_show_success VCR.use_cassette('member show success') do - request = Access::Member.show '226872', program_id: '2412', api_environment: 'stage' + request = Access::Member.show_member '226872', program_id: '2412', api_environment: 'stage' assert request.success assert_kind_of Access::MemberResponse, request assert_kind_of Hash, request.response end end def test_member_show_failure VCR.use_cassette('member show failure') do - request = Access::Member.show '12345', program_id: '00112233', api_environment: 'stage' + request = Access::Member.show_member '12345', program_id: '00112233', api_environment: 'stage' assert_equal 404, request.status assert_kind_of Access::MemberResponse, request assert_kind_of Hash, request.response end end def test_member_update VCR.use_cassette('member update success') do - request = Access::Member.update '226872', program_id: '2412', api_environment: 'stage', birth_date: Date.today + request = Access::Member.update_member '226872', program_id: '2412', api_environment: 'stage', birth_date: Date.today assert request.success assert_kind_of Access::MemberResponse, request assert_kind_of Hash, request.response assert_equal request.response["birth_date"], Date.today.to_s end end - def registration_params - { - program_id: 2412, - first_name: 'RubyGem', - last_name: 'Test', - postal_code: 84047, - email: "rubygemtest-3@accessdevelopment.com", - password: 'test1234', - shared_secret: 'thanks', - program_url: "saversclub.accessdevelopment.com", - access_timeout: 180 - } - end end