Skip to content

Commit 1febaf7

Browse files
surajitsurajit
authored andcommitted
run black on test files
1 parent 36bb9eb commit 1febaf7

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

tests/routes/test_company.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
@mock.patch("routes.v1.company.utils.get_company_by_name")
88
@mock.patch("logger.log.logger.debug")
9-
def test_company(mock_logger_debug,
10-
mock_get_company_by_name, client):
9+
def test_company(mock_logger_debug, mock_get_company_by_name, client):
1110
mock_logger_debug.return_value = "Ok"
1211
mock_get_company_by_name.return_value = {"id": 12345}
1312
response = client.get("/api/v1/company/test-company/")
@@ -17,8 +16,9 @@ def test_company(mock_logger_debug,
1716

1817
@mock.patch("routes.v1.company.utils.get_company_by_name")
1918
@mock.patch("logger.log.logger.debug")
20-
def test_company_for_hubspot_company_exception(mock_logger_debug,
21-
mock_get_company_by_name, client):
19+
def test_company_for_hubspot_company_exception(
20+
mock_logger_debug, mock_get_company_by_name, client
21+
):
2222
mock_logger_debug.return_value = "Ok"
2323
mock_get_company_by_name.side_effect = CompanyException(
2424
"Something went wrong in fetching company from Hubspot"
@@ -44,8 +44,9 @@ def test_create_company(mock_logger_debug, mock_create_company, client):
4444

4545
@mock.patch("routes.v1.company.utils.create_company")
4646
@mock.patch("logger.log.logger.debug")
47-
def test_create_company_with_hubspot_company_exception(mock_logger_debug, mock_create_company,
48-
client, db):
47+
def test_create_company_with_hubspot_company_exception(
48+
mock_logger_debug, mock_create_company, client, db
49+
):
4950
mock_logger_debug.return_value = "Ok"
5051
mock_create_company.side_effect = CompanyException(
5152
"Something went wrong in creating company in Hubspot"
@@ -62,30 +63,32 @@ def test_create_company_with_hubspot_company_exception(mock_logger_debug, mock_c
6263

6364

6465
@mock.patch("logger.log.logger.debug")
65-
def test_create_company_with_duplicate_organization_org_id(mock_logger_debug,
66-
client, organization):
66+
def test_create_company_with_duplicate_organization_org_id(
67+
mock_logger_debug, client, organization
68+
):
6769
mock_logger_debug.return_value = "Ok"
6870
response = client.post(
6971
"/api/v1/companies/", json={"org_id": 12345, "name": "UWISO"}
7072
)
7173
assert response.status_code == 200
7274
assert response.json() == {
7375
"detail": "duplicate key value violates unique constraint "
74-
'"organization_org_id_key"\nDETAIL: Key (org_id)=('
75-
"12345) already exists.\n"
76+
'"organization_org_id_key"\nDETAIL: Key (org_id)=('
77+
"12345) already exists.\n"
7678
}
7779

7880

7981
@mock.patch("logger.log.logger.debug")
80-
def test_create_company_with_duplicate_organization_name(mock_logger_debug,
81-
client, organization):
82+
def test_create_company_with_duplicate_organization_name(
83+
mock_logger_debug, client, organization
84+
):
8285
mock_logger_debug.return_value = "Ok"
8386
response = client.post(
8487
"/api/v1/companies/", json={"org_id": 1232245, "name": "Test org"}
8588
)
8689
assert response.status_code == 200
8790
assert response.json() == {
8891
"detail": "duplicate key value violates unique constraint "
89-
'"organization_name_key"\nDETAIL: Key (name)=('
90-
"Test org) already exists.\n"
92+
'"organization_name_key"\nDETAIL: Key (name)=('
93+
"Test org) already exists.\n"
9194
}

tests/routes/test_contact.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ def test_get_contact_by_email(mock_logger_debug, mock_get_contact_by_email, clie
2828
@mock.patch("routes.v1.contact._contact.create_contact")
2929
@mock.patch("logger.log.logger.debug")
3030
def test_create_contact(
31-
mock_logger_debug, mock_db_create_contact, mock_hubspot_create_contact, organization, client
31+
mock_logger_debug,
32+
mock_db_create_contact,
33+
mock_hubspot_create_contact,
34+
organization,
35+
client,
3236
):
3337
mock_logger_debug.return_value = "Ok"
3438
mock_db_create_contact.return_value = {
@@ -53,8 +57,9 @@ def test_create_contact(
5357

5458

5559
@mock.patch("logger.log.logger.debug")
56-
def test_create_contact_returns_duplicate_email_error(mock_logger_debug,
57-
organization, contact, client):
60+
def test_create_contact_returns_duplicate_email_error(
61+
mock_logger_debug, organization, contact, client
62+
):
5863
mock_logger_debug.return_value = "Ok"
5964
response = client.post(
6065
"/api/v1/contacts/",
@@ -69,17 +74,16 @@ def test_create_contact_returns_duplicate_email_error(mock_logger_debug,
6974
assert response.status_code == 200
7075
assert response.json() == {
7176
"detail": "duplicate key value violates unique constraint "
72-
'"contact_email_key"\nDETAIL: Key (email)=('
73-
"[email protected]) already exists.\n"
77+
'"contact_email_key"\nDETAIL: Key (email)=('
78+
"[email protected]) already exists.\n"
7479
}
7580

7681

7782
@mock.patch("routes.v1.contact._contact.delete_contact")
7883
@mock.patch("routes.v1.contact.utils.create_contact")
7984
@mock.patch("logger.log.logger.debug")
8085
def test_create_contact_raises_hubspot_contactexception(
81-
mock_logger_debug,
82-
mock_create_contact, mock_delete_contact, organization, client
86+
mock_logger_debug, mock_create_contact, mock_delete_contact, organization, client
8387
):
8488
mock_logger_debug.return_value = "Ok"
8589
mock_create_contact.side_effect = ContactException(
@@ -103,7 +107,7 @@ def test_create_contact_raises_hubspot_contactexception(
103107
@mock.patch("routes.v1.contact.utils.create_contact")
104108
@mock.patch("logger.log.logger.debug")
105109
def test_create_contact_rollbacks_db_contact_for_hubspot_exception(
106-
mock_logger_debug, mock_create_contact, db, organization, client
110+
mock_logger_debug, mock_create_contact, db, organization, client
107111
):
108112
mock_logger_debug.return_value = "Ok"
109113
mock_create_contact.side_effect = ContactException(

0 commit comments

Comments
 (0)