-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d1eae0
commit e86ae86
Showing
10 changed files
with
222 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,7 @@ venv/ | |
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
website/docs/.env | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Product 1: Himmel Soft Memory Foam Mattress | ||
Dive into the luxury of the Himmel Soft Memory Foam Mattress, a masterpiece of comfort and design. This mattress features a temperature-sensitive memory foam that contours to your body, providing customized support and exceptional comfort. It is built on a durable high-density foam base that retains its shape and firmness over time. Enhanced with cooling gel particles, it helps maintain an optimal sleeping temperature all night. The soft, hypoallergenic cover, beautifully stitched with elegant patterns, not only decorates your space but also protects against allergens. Choose the Himmel Soft Memory Foam Mattress for a rejuvenating sleep experience. | ||
Price: $950 | ||
Sizes available for this product: Twin, Queen, King | ||
|
||
Product 2: Tradfri Pocket Spring Mattress | ||
Experience the perfect combination of tradition and modernity with our Tradfri Pocket Spring Mattress. It boasts a sturdy pocket spring core surrounded by luxurious padding layers that provide a balanced support and plush comfort. The top layer is quilted and soft, enhancing the comfort with a touch of luxury. The reinforced edges offer increased durability and a uniform sleep surface. Its natural cotton cover efficiently absorbs moisture, ensuring a dry and pleasant sleep environment. The Tradfri Pocket Spring Mattress is ideal for those who value a harmonious blend of support and softness. | ||
Price: $1,250 | ||
Sizes available for this product: Queen, King | ||
|
||
Product 3: Grönblad Natural Latex Mattress | ||
The Grönblad Natural Latex Mattress is our commitment to sustainable comfort. Crafted from 100% natural latex sourced from environmentally responsible plantations, this mattress delivers a dynamic, supportive sleep while offering excellent pressure relief. It features a base of individually encased coils that reduce motion transfer, making it ideal for couples. Covered in certified organic cotton, it provides a soft, breathable sleeping surface. With its natural antimicrobial and hypoallergenic qualities, the Grönblad is an excellent choice for those with allergies, combining eco-friendliness with luxurious comfort. | ||
Price: $1,550 | ||
Sizes available for this product: Twin, Full | ||
|
||
Product 4: Skogsliden Bamboo Mattress | ||
Elevate your sleep with the Skogsliden Bamboo Mattress, where comfort meets sustainability. This mattress includes a layer of adaptive foam that conforms to your body, supported by a durable base foam that prevents sagging. The highlight is its bamboo-infused top layer, offering a soft, cool touch and excellent moisture management, thanks to bamboo's natural properties. The removable bamboo cover is silky and easy to care for, ensuring a clean and refreshing sleep environment. The Skogsliden Bamboo Mattress is a luxurious choice for those seeking eco-friendly sleep solutions. | ||
Price: $2,500 | ||
Sizes available for this product: King |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import pytest | ||
from unittest.mock import patch, MagicMock | ||
from salesgpt.tools import generate_stripe_payment_link, send_email_tool, generate_calendly_invitation_link | ||
import os | ||
import json | ||
|
||
@pytest.fixture | ||
def mock_requests_post(): | ||
with patch("salesgpt.tools.requests.request") as mock_post: | ||
yield mock_post | ||
|
||
@pytest.fixture | ||
def mock_smtplib(): | ||
with patch("salesgpt.tools.smtplib.SMTP_SSL") as mock_smtp: | ||
yield mock_smtp | ||
|
||
@pytest.fixture | ||
def mock_requests(): | ||
with patch("salesgpt.tools.requests.post") as mock_post: | ||
yield mock_post | ||
|
||
def test_generate_stripe_payment_link(mock_requests_post): | ||
# Mock the response of the requests.post call within your tool function | ||
mock_response = MagicMock() | ||
mock_response.text = "https://mocked_payment_link.com" | ||
mock_response.status_code = 200 | ||
mock_requests_post.return_value = mock_response | ||
|
||
# Mock the get_product_id_from_query function to return a valid JSON string | ||
with patch("salesgpt.tools.get_product_id_from_query", return_value=json.dumps({"price_id": "price_123"})): | ||
# Call the function you're testing | ||
result = generate_stripe_payment_link("query about a product") | ||
|
||
# Assert that the result is as expected | ||
assert result == "https://mocked_payment_link.com", "The function should return the URL from the mocked response." | ||
|
||
# Additionally, you can assert that the requests.post was called with the correct arguments | ||
mock_requests_post.assert_called_once() | ||
|
||
def test_send_email_tool(mock_smtplib): | ||
# Mock the SMTP server object and its methods | ||
mock_server = MagicMock() | ||
mock_smtplib.return_value = mock_server | ||
|
||
# Mock the email details extraction | ||
email_details = { | ||
"recipient": "[email protected]", | ||
"subject": "Test Subject", | ||
"body": "Test Body" | ||
} | ||
with patch("salesgpt.tools.get_mail_body_subject_from_query", return_value=json.dumps(email_details)): | ||
result = send_email_tool("query about sending an email") | ||
assert result == "Email sent successfully.", "The function should return a success message." | ||
|
||
mock_smtplib.assert_called_once_with('smtp.gmail.com', 465) | ||
mock_server.login.assert_called_once_with(os.getenv("GMAIL_MAIL"), os.getenv("GMAIL_APP_PASSWORD")) | ||
mock_server.sendmail.assert_called_once() | ||
mock_server.quit.assert_called_once() | ||
|
||
def test_generate_calendly_invitation_link(mock_requests): | ||
mock_response = MagicMock() | ||
mock_response.status_code = 201 | ||
mock_response.json.return_value = { | ||
"resource": { | ||
"booking_url": "https://mocked_calendly_link.com" | ||
} | ||
} | ||
mock_requests.return_value = mock_response | ||
result = generate_calendly_invitation_link("query about a meeting") | ||
|
||
assert result == "url: https://mocked_calendly_link.com", "The function should return the URL from the mocked response." | ||
mock_requests.assert_called_once() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.