Skip to content

Commit 050e29d

Browse files
authored
Merge pull request #9 from SEED-platform/prep-tests
restore tests
2 parents c07653b + c1bd94e commit 050e29d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "seed-salesforce"
33
version = "0.1.0"
44
description = "Package for connecting SEED data to Salesforce"
5-
authors = ["Nicholas Long <[email protected]>"]
5+
authors = ["Nicholas Long <[email protected]>", "Katherine Fleming <[email protected]>"]
66
license = "BSD-3-Clause"
77

88
readme = "README.md"

tests/test_salesforce_client.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/seed-platform/seed-salesforce/blob/develop/LICENSE.md
22

3+
import random
34
import unittest
45
from pathlib import Path
56

@@ -14,7 +15,7 @@ def test_init_by_file(self):
1415
sf = SalesforceClient(connection_config_filepath=config_file)
1516
# check if the Salesforce connection has the base_url method and that it is not None
1617
assert hasattr(sf.connection, 'base_url')
17-
print(f"sf connection: {sf.connection.base_url}")
18+
# print(f"sf connection: {sf.connection.base_url}")
1819
assert sf.connection.base_url is not None
1920

2021

@@ -37,9 +38,10 @@ def setUp(self) -> None:
3738

3839
return super().setUp()
3940

40-
@pytest.mark.skip(reason="Need to confirm that this is a valid test")
41+
# @pytest.mark.skip(reason="Need to confirm that this is a valid test")
4142
def test_search_and_create_and_delete_account(self):
42-
test_account_name = 'Scrumptious Ice Cream'
43+
r = random.randrange(1, 5000, 2)
44+
test_account_name = 'Scrumptious Ice Cream' + str(r)
4345
account = self.sf.find_account_by_name(test_account_name)
4446
# The first time should not have any results
4547
assert not account
@@ -61,16 +63,16 @@ def test_search_and_create_and_delete_account(self):
6163

6264
# Find the record
6365
account = self.sf.find_account_by_name(test_account_name)
64-
print(f"hasdlfkjasdlfkjasdflkj {account}")
6566
assert account['Id'] == account_id
6667

6768
# now delete it to cleanup
6869
success = self.sf.delete_account_by_id(account_id)
6970
assert success
7071

71-
@pytest.mark.skip(reason="Need to confirm that this is a valid test")
72+
# @pytest.mark.skip(reason="Need to confirm that this is a valid test")
7273
def test_update_contact_and_account(self):
73-
test_account_name = 'A Fake Account'
74+
r = random.randrange(1, 5000, 2)
75+
test_account_name = 'A Fake Account' + str(r)
7476
details = {
7577
'Type': 'Office',
7678
'Phone': '555-867-5309',
@@ -93,22 +95,22 @@ def test_update_contact_and_account(self):
9395
# create contact (associated with account)
9496
details = {
9597
'AccountId': account_id,
96-
'LastName': 'Richard Hendrick'
98+
'LastName': 'Richard Hendrick' + str(r)
9799
}
98100
if self.contact_record_type:
99101
details['RecordTypeID'] = self.contact_record_type
100102

101-
self.sf.create_contact('[email protected]', **details)
103+
self.sf.create_contact('user' + str(r) + '@company.com', **details)
102104
# retrieve contact
103-
contact = self.sf.find_contact_by_email('[email protected]')
105+
contact = self.sf.find_contact_by_email('user' + str(r) + '@company.com')
104106
assert contact['AccountId'] == account_id
105107

106108
# update contact (can't change email)
107109
details = {
108110
'AccountId': account_id,
109-
'LastName': 'Russ Hanneman'
111+
'LastName': 'Russ Hanneman' + str(r)
110112
}
111-
self.sf.create_or_update_contact_on_account('[email protected]', **details)
113+
self.sf.create_or_update_contact_on_account('user' + str(r) + '@company.com', **details)
112114
assert contact['AccountId'] == account_id
113115

114116
# now delete it to cleanup

0 commit comments

Comments
 (0)