-
Notifications
You must be signed in to change notification settings - Fork 0
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
1bbe82b
commit 0e769aa
Showing
14 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-4 Bytes
(100%)
analytics/migrations/__pycache__/0001_initial.cpython-312.pyc
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,3 +1,35 @@ | ||
from django.test import TestCase | ||
from django.test import TestCase, Client | ||
from django.urls import reverse | ||
import json | ||
from unittest.mock import patch | ||
|
||
# Create your tests here. | ||
class HubSpotIntegrationTest(TestCase): | ||
def setUp(self): | ||
self.client = Client() | ||
self.update_url = reverse('update_hubspot_lead', kwargs={'pk': '36659094211'}) | ||
self.valid_payload = { | ||
"properties": { | ||
"firstname": "new_firstname", | ||
"lastname": "new_lastname" | ||
} | ||
} | ||
|
||
@patch('analytics.views.update_hubspot_lead') | ||
def test_update_hubspot_lead(self, mock_update_hubspot_lead): | ||
mock_update_hubspot_lead.return_value.status_code = 200 | ||
mock_update_hubspot_lead.return_value.json.return_value = { | ||
"properties": { | ||
"firstname": "new_firstname", | ||
"lastname": "new_lastname" | ||
} | ||
} | ||
|
||
response = self.client.put( | ||
self.update_url, | ||
data=json.dumps(self.valid_payload), | ||
content_type='application/json' | ||
) | ||
|
||
self.assertEqual(response.status_code, 200) | ||
self.assertIn('new_firstname', response.json()['results'][0]['firstname']) | ||
self.assertIn('new_lastname', response.json()['results'][0]['lastname']) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.