Skip to content

Instantly share code, notes, and snippets.

@spirosoik
Created February 26, 2021 12:59
Show Gist options
  • Save spirosoik/3074bd95aeb7070a6276b8518bb82028 to your computer and use it in GitHub Desktop.
Save spirosoik/3074bd95aeb7070a6276b8518bb82028 to your computer and use it in GitHub Desktop.
func (s *eventTestSuite) TestAwSuccesfullyDeployedButCrmFailed() {
//given
s.asAnonymousUser().signup().and().deployLensesAWS()
// when
s.deployedSuccesfullyAWS()
// then
s.handleLeadCrmIntegrationError()
}
func (s *eventTestSuite) deployedSuccesfullyAWS() *eventTestSuite {
s.crmClient.createLead = func(req pardot.LeadRequest) (int64, error) {
return s.crmID, nil
}
s.crmClient.udpateQualification = func(req pardot.LeadUpdateQualificationRequest) error {
return nil
}
s.crmClient.updateAWSActivityEvent = func(crmID int64) error {
return nil
}
s.crmClient.updateAWSDeploymentState = func(crmID int64, state string) error {
return errors.New("Failed to update CRM")
}
s.err = s.eventHandler.HandleEvent(context.Background(), testutil.EventToSQSEvent(leads.AwsDeploymentStateChangedEvent{
BaseEvent: leads.BaseEvent{
UserURN: s.userURN,
},
State: leads.DeploymentCreating,
}))
return s
}
func (s *eventTestSuite) handleLeadCrmIntegrationError() {
assert.Error(s.T(), s.err)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment