Neeraj

Neeraj

Unit Testing Sendgrid API requests

I was handed a project build in elixir which sends out notifications from different products in the organization using Sendgrid. One of my tasks is to build unit tests specifically for testing integration with Sendgrid.

The project uses GitHub - alexgaribay/sendgrid_elixir: Create and send composable emails with Elixir and SendGrid. · GitHub library to integrate with Sendgrid.

Coming from a Ruby background I tried using ExVCR to try and record HTTP responses from the above library but they are not compatible mainly because the library uses Tesla to send Http requests.

The ask is to build self contained tests that do not rely on specifying the Sendgrid API key to run them as the library requires.

Can anyone help me with reaching a solution ?

First Post!

hauleth

hauleth

Use Bypass if you can. Alternatively you can implement custom adapter that will allow you to intercept the requests (in fact I think it would be nice addition to Tesla itself).

Where Next?

Popular in Questions Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New

We're in Beta

About us Mission Statement