-
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.
Merge pull request #18 from mailerlite/feature/issue-14/forget-api
feat(tests): Added test for Forget API
- Loading branch information
Showing
8 changed files
with
188 additions
and
8 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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[flake8] | ||
max-line-length = 200 | ||
max-line-length = 300 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.1.2 | ||
0.1.3 |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
authors = ["MailerLite <[email protected]>"] | ||
description = "The official MailerLite Python SDK" | ||
name = "mailerlite" | ||
version = "0.1.2" | ||
version = "0.1.3" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.7" | ||
|
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 |
---|---|---|
|
@@ -234,7 +234,7 @@ def test_given_correct_subscriber_id_and_grop_id_when_calling_unassign_subscribe | |
ip_address="1.1.1.1", | ||
) | ||
group = self.client.groups.create(name) | ||
assign = self.client.subscribers.assign_subscriber_to_group( | ||
self.client.subscribers.assign_subscriber_to_group( | ||
int(subscriber["data"]["id"]), int(group["data"]["id"]) | ||
) | ||
response = self.client.subscribers.unassign_subscriber_from_group( | ||
|
@@ -243,7 +243,7 @@ def test_given_correct_subscriber_id_and_grop_id_when_calling_unassign_subscribe | |
self.client.subscribers.delete(int(subscriber["data"]["id"])) | ||
self.client.groups.delete(int(group["data"]["id"])) | ||
|
||
assert response == True | ||
assert response is True | ||
|
||
def test_given_invalid_subscriber_id_when_calling_delete_then_returning_subscirber_will_fail( | ||
self, | ||
|
@@ -266,8 +266,24 @@ def test_given_valid_subscriber_id_when_calling_delete_then_subscriber_is_delete | |
@vcr.use_cassette( | ||
"tests/vcr_cassettes/subscribers-count.yml", filter_headers=["Authorization"] | ||
) | ||
def test_list_of_all_subscribers_should_be_returned(self, subscriber_keys): | ||
def test_count_of_all_subscribers_should_be_returned(self, subscriber_keys): | ||
response = self.client.subscribers.count() | ||
|
||
assert isinstance(response, dict) | ||
assert "total" in response | ||
|
||
@vcr.use_cassette( | ||
"tests/vcr_cassettes/subscribers-forget.yml", filter_headers=["Authorization"] | ||
) | ||
def test_given_correct_params_when_calling_forget_then_subscirber_is_marked_as_forgotten( | ||
self, | ||
): | ||
user = self.client.subscribers.create( | ||
"[email protected]", | ||
fields={"name": "John", "last_name": "Doe"}, | ||
ip_address="1.1.1.1", | ||
) | ||
|
||
response = self.client.subscribers.forget(int(user["data"]["id"])) | ||
|
||
assert response == 200 |
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,124 @@ | ||
interactions: | ||
- request: | ||
body: '{"email": "[email protected]", "fields": {"name": "John", "last_name": "Doe"}, | ||
"ip_address": "1.1.1.1"}' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '101' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- MailerLite-Python-SDK-Client | ||
method: POST | ||
uri: https://connect.mailerlite.com/api/subscribers | ||
response: | ||
body: | ||
string: !!binary | | ||
H4sIAAAAAAAAA4SRz2oDIRDGXyXM2Q2uu7LEUw899RVKEaO2GbqromOhDXn3Ypp/LYTixd98M87M | ||
5x6cIQNqD+hAwSQ5n6ZRDlKO/SSHARj4xeAMCsgXkg9HWtu4AINChmoBBcYSfvgWiTVb3yIJG/pA | ||
oDiDmHwo2sZ6Yjujfb8NtASdDfmrfEVM2jiXfWm9+vXxtNfrttiMW++0IVAguBBdLzrBVz1Xo1Aj | ||
BwY1/MkLdZ4Z2OwN/VOZ3K+UoeOyE+Oq3ygplNgAg1f0syvNvmCWtvdT3AVgMJtC+hR6jM0ZG5dk | ||
wuelfds8XxHpck+7GPwZmsUX+NKo0xnad+itIbvTxyl0f1cRd5XhrjL+KAcGbznWVEA9vzCYozWE | ||
MZzLYmoGYbgxNibCoPE05+HwDQAA//8DABEp4vdiAgAA | ||
headers: | ||
CF-Cache-Status: | ||
- DYNAMIC | ||
CF-RAY: | ||
- 7cc815e1ee47b903-AMS | ||
Connection: | ||
- keep-alive | ||
Content-Encoding: | ||
- gzip | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Wed, 24 May 2023 19:53:34 GMT | ||
Server: | ||
- cloudflare | ||
Strict-Transport-Security: | ||
- max-age=15724800; includeSubDomains | ||
Transfer-Encoding: | ||
- chunked | ||
VIA: | ||
- Ingress | ||
access-control-allow-origin: | ||
- '*' | ||
cache-control: | ||
- no-cache, private | ||
x-locale: | ||
- en | ||
x-ratelimit-limit: | ||
- '120' | ||
x-ratelimit-remaining: | ||
- '119' | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: 'null' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '4' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- MailerLite-Python-SDK-Client | ||
method: POST | ||
uri: https://connect.mailerlite.com/api/subscribers/75007745355417533/forget | ||
response: | ||
body: | ||
string: !!binary | | ||
H4sIAAAAAAAAA4RSy24bIRT9FXTXjMXATK2y6qKrbruMKoTh1kZhAMGdRG6Uf69w/UolK2LDeVxm | ||
OIc38JYs6DcIHjRsZyG222lW8zyN21kp4ICLDRE0EDaav53QxuUFODSytDbQYB2FF+xMXqvDzpTQ | ||
ISYCLTjkgqkZl9czdjG453uiG0y1hDf5BkMx1vuKrX9r3JxWP33dNVfDDr2xBBqkkHIY5SAFG4We | ||
pJ4EcFjTf760xsjBVbT0yWTxHyxqEPMgJzZ+1bPSagIOHiN+Yvmd6x7p3vFlkOqDI2D0rXeQ7NLD | ||
+5EPCThE28icqe+5x+vyUmw6Xu/Q46s3GOi6L4ec8AJ6T1fwxwRTLqB3anaW3MGc/sKMDxX5UFEP | ||
lemf8s5hX/NaGuinXxxidpZCTpexXHqEId21kwuFZEK5zi/Ymt33JH5e2qysP132GmJkO2Q9m15G | ||
PLJzK8wmz3r8mQgTew10CIkpwbw9tg28/wUAAP//AwCHbe7y/AIAAA== | ||
headers: | ||
CF-Cache-Status: | ||
- DYNAMIC | ||
CF-RAY: | ||
- 7cc815e478acb772-AMS | ||
Connection: | ||
- keep-alive | ||
Content-Encoding: | ||
- gzip | ||
Content-Type: | ||
- application/json | ||
Date: | ||
- Wed, 24 May 2023 19:53:34 GMT | ||
Server: | ||
- cloudflare | ||
Strict-Transport-Security: | ||
- max-age=15724800; includeSubDomains | ||
Transfer-Encoding: | ||
- chunked | ||
VIA: | ||
- Ingress | ||
access-control-allow-origin: | ||
- '*' | ||
cache-control: | ||
- no-cache, private | ||
x-locale: | ||
- en | ||
x-ratelimit-limit: | ||
- '120' | ||
x-ratelimit-remaining: | ||
- '118' | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |