Skip to content

minxhe/Mock-Services-Serverless-Framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Mock-Services-Serverless-Framework

A service factory designed to improve the workflow of automations by mocking 3rd party services (eg. Appboy, Paypal) using Python 2.7, Serverless Framework, AWS Lambda and DynamoDB.

Overview:

Main idea:

By modifying part of the request body sent to 3rd party service, to obtain the result you expect in order to effectly test your backend services. (Mostly edge cases or rare occuring cases)

Example:

To Test Error Handling on Payouts "PENDING" State of Paypal Batch Payouts Endpoint

Mock reqeust body:

{
  "sender_batch_header": {
  "sender_batch_id": "PENDING",
  "email_subject": "You have a payout!"
  },
  "items": []
}

Mock reponse data:

{
  "batch_header": {
    "sender_batch_header": {
      "sender_batch_id": "2014021801",
      "email_subject": "You have a payout!"
    },
    "payout_batch_id": "12345678",
    "batch_status": "PENDING"
  }
}

Requirements:

npm install -g serverless

Deploy to AWS Stack

  • Clone the repository
  • Navigate to one of the services
  • Deploy with
serverlss deploy --aws-profile <profile_name> (default is "default")
  • You should see your API endpoints at the end of the deployment

Logs:

Go into the directory of a specific mock service

serverless logs -f <function_name> -t --aws-profile <profile_name> --stage-<stage_name>

About

Mock Services built using Python and AWS Lambda (Serverless Framework) to improve testing flow.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages