Sha256: d97b64d7182cc683fea6783c433b26f2495a9ed47a475a3743ab6ff03004983a

Contents?: true

Size: 1.53 KB

Versions: 13

Compression:

Stored size: 1.53 KB

Contents

require File.dirname(__FILE__) + '/helper'

class PersonTest < Test::Unit::TestCase
  multiple_contexts "authenticated_using_oauth_context", "authenticated_using_api_key_context" do
    setup do
      @client_id = "d98h2938d9283d982u3d98u88"
      @person = CreateSend::Person.new @auth, @client_id, "person@example.com"
    end

    should "get a person by client id and email address" do
      email = "person@example.com"
      stub_get(@auth, "clients/#{@client_id}/people.json?email=#{CGI.escape(email)}", "person_details.json")
      person = CreateSend::Person.get @auth, @client_id, email
      person.EmailAddress.should == email
      person.Name.should == "Person One"
      person.AccessLevel.should == 1023
      person.Status.should == "Active"
    end

    should "add a person" do
      stub_post(@auth, "clients/#{@client_id}/people.json", "add_person.json")
      result = CreateSend::Person.add @auth, @client_id, "person@example.com", "Person", 0, "Password"
      result.EmailAddress.should == "person@example.com"
    end

    should "update a person" do
      email = "person@example.com"
      new_email = "new_email_address@example.com"
      stub_put(@auth, "clients/#{@client_id}/people.json?email=#{CGI.escape(email)}", nil)
      @person.update new_email, "Person", 1023, "NewPassword"
      @person.email_address.should == new_email
    end
      
    should "delete a person" do
      stub_delete(@auth, "clients/#{@person.client_id}/people.json?email=#{CGI.escape(@person.email_address)}", nil)
      @person.delete
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
createsend-5.0.0 test/person_test.rb
createsend-4.1.2 test/person_test.rb
createsend-4.1.1 test/person_test.rb
createsend-4.1.0 test/person_test.rb
createsend-4.0.2 test/person_test.rb
createsend-4.0.1 test/person_test.rb
createsend-4.0.0 test/person_test.rb
createsend-3.4.0 test/person_test.rb
createsend-3.3.0 test/person_test.rb
createsend-3.2.0 test/person_test.rb
createsend-3.1.1 test/person_test.rb
createsend-3.1.0 test/person_test.rb
createsend-3.0.0 test/person_test.rb