Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding MarketingStatus field to Person and PersonUpdate, allowing you… #129

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

andyb1979
Copy link

@andyb1979 andyb1979 commented Sep 28, 2022

Very small change to allow get/set of MarketingStatus.

We are populating a CRM after signup from a website and need to set MarketingStatus to subscribed. For our own IntegrationTest purposes I'd like to be able to get MarketingStatus as well

Integration tests need to be added, for example I have two persons, one unsubscribed and one subscribed. This test allows me to get and update the statuses:

[IntegrationTest]
public async Task CanRetrievePersonMarketingStatus()
{
    var pipedrive = Helper.GetAuthenticatedClient();

    // Assume person with Id 123 exists and has status subscribed
    var person = await pipedrive.Person.Get(123);

    Assert.Equal("[email protected]", person.Email[0].Value);
    Assert.Equal("subscribed", person.MarketingStatus);

    // Assume person with Id 456 exists and has status no_consent
    var person2 = await pipedrive.Person.Get(456);

    Assert.Equal("[email protected]", person2.Email[0].Value);
    Assert.Equal("no_consent", person2.MarketingStatus);

    // Update person 456 
    var data = person2.ToUpdate();
    Assert.Equal(data.MarketingStatus, "no_consent");
    data.MarketingStatus = "subscribed";

    var person2Updated = await pipedrive.Person.Edit(person2.Id, data);
    Assert.Equal("subscribed", person2Updated.MarketingStatus);
}

Now question how to reset that status for the next test. Personally I'd set it back in teardown or create the person for the test. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants