-
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 #9 from SEED-platform/prep-tests
restore tests
- Loading branch information
Showing
2 changed files
with
14 additions
and
12 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "seed-salesforce" | ||
version = "0.1.0" | ||
description = "Package for connecting SEED data to Salesforce" | ||
authors = ["Nicholas Long <[email protected]>"] | ||
authors = ["Nicholas Long <[email protected]>", "Katherine Fleming <[email protected]>"] | ||
license = "BSD-3-Clause" | ||
|
||
readme = "README.md" | ||
|
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,5 +1,6 @@ | ||
# Copyright (c) Alliance for Sustainable Energy, LLC. See also https://github.com/seed-platform/seed-salesforce/blob/develop/LICENSE.md | ||
|
||
import random | ||
import unittest | ||
from pathlib import Path | ||
|
||
|
@@ -14,7 +15,7 @@ def test_init_by_file(self): | |
sf = SalesforceClient(connection_config_filepath=config_file) | ||
# check if the Salesforce connection has the base_url method and that it is not None | ||
assert hasattr(sf.connection, 'base_url') | ||
print(f"sf connection: {sf.connection.base_url}") | ||
# print(f"sf connection: {sf.connection.base_url}") | ||
assert sf.connection.base_url is not None | ||
|
||
|
||
|
@@ -37,9 +38,10 @@ def setUp(self) -> None: | |
|
||
return super().setUp() | ||
|
||
@pytest.mark.skip(reason="Need to confirm that this is a valid test") | ||
# @pytest.mark.skip(reason="Need to confirm that this is a valid test") | ||
def test_search_and_create_and_delete_account(self): | ||
test_account_name = 'Scrumptious Ice Cream' | ||
r = random.randrange(1, 5000, 2) | ||
test_account_name = 'Scrumptious Ice Cream' + str(r) | ||
account = self.sf.find_account_by_name(test_account_name) | ||
# The first time should not have any results | ||
assert not account | ||
|
@@ -61,16 +63,16 @@ def test_search_and_create_and_delete_account(self): | |
|
||
# Find the record | ||
account = self.sf.find_account_by_name(test_account_name) | ||
print(f"hasdlfkjasdlfkjasdflkj {account}") | ||
assert account['Id'] == account_id | ||
|
||
# now delete it to cleanup | ||
success = self.sf.delete_account_by_id(account_id) | ||
assert success | ||
|
||
@pytest.mark.skip(reason="Need to confirm that this is a valid test") | ||
# @pytest.mark.skip(reason="Need to confirm that this is a valid test") | ||
def test_update_contact_and_account(self): | ||
test_account_name = 'A Fake Account' | ||
r = random.randrange(1, 5000, 2) | ||
test_account_name = 'A Fake Account' + str(r) | ||
details = { | ||
'Type': 'Office', | ||
'Phone': '555-867-5309', | ||
|
@@ -93,22 +95,22 @@ def test_update_contact_and_account(self): | |
# create contact (associated with account) | ||
details = { | ||
'AccountId': account_id, | ||
'LastName': 'Richard Hendrick' | ||
'LastName': 'Richard Hendrick' + str(r) | ||
} | ||
if self.contact_record_type: | ||
details['RecordTypeID'] = self.contact_record_type | ||
|
||
self.sf.create_contact('[email protected]', **details) | ||
self.sf.create_contact('user' + str(r) + '@company.com', **details) | ||
# retrieve contact | ||
contact = self.sf.find_contact_by_email('[email protected]') | ||
contact = self.sf.find_contact_by_email('user' + str(r) + '@company.com') | ||
assert contact['AccountId'] == account_id | ||
|
||
# update contact (can't change email) | ||
details = { | ||
'AccountId': account_id, | ||
'LastName': 'Russ Hanneman' | ||
'LastName': 'Russ Hanneman' + str(r) | ||
} | ||
self.sf.create_or_update_contact_on_account('[email protected]', **details) | ||
self.sf.create_or_update_contact_on_account('user' + str(r) + '@company.com', **details) | ||
assert contact['AccountId'] == account_id | ||
|
||
# now delete it to cleanup | ||
|