-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tested -- code for pulling data from the Opt-In results spreadsheet,
check user email for response, store response data in dict
- Loading branch information
1 parent
61e4795
commit 07dee09
Showing
6 changed files
with
59 additions
and
35 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,3 @@ | ||
from .solr_tests import * | ||
from .metadata_utils_tests import * | ||
from .sheets_tests import * |
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,30 +1,34 @@ | ||
import unittest | ||
from google_helpers.sheets.sheets_support import SheetsSupport | ||
from google_helpers.sheets.opt_in_support import OptInSupport | ||
|
||
try: | ||
from google_helpers.sheets.sheets_support import SheetsSupport | ||
except ImportError: | ||
print("[ERROR] Failed to import test subject: {}".format("SheetsSupport")) | ||
|
||
try: | ||
from google_helpers.sheets.opt_in_support import OptInSupport | ||
except ImportError: | ||
print("[ERROR] Failed to import test subject: {}".format("OptInSupport")) | ||
|
||
class TestSheetsSupport(unittest.TestCase): | ||
def test_get_sheet_data(self): | ||
test_sheet_obj = SheetsSupport("Sheet1", "1FUZqWZv5drJDH4kqi0pU-oau0qVhFKevhbKRMMZrLmA") | ||
test_sheet_obj = SheetsSupport("Form Responses 1", "1FUZqWZv5drJDH4kqi0pU-oau0qVhFKevhbKRMMZrLmA") | ||
data = test_sheet_obj.get_sheet_data() | ||
|
||
self.assertTrue(type(data) is list) | ||
|
||
""" | ||
|
||
class TestOptInSupport(unittest.TestCase): | ||
def test_set_user_response(self): | ||
pass | ||
lwolfe_response = OptInSupport("[email protected]") | ||
lwolfe2_response = OptInSupport("[email protected]") | ||
no_response = OptInSupport("[email protected]") | ||
|
||
def test_has_responded(self): | ||
pass | ||
""" | ||
self.assertTrue(self.lwolfe_response.has_responded()) | ||
|
||
self.assertFalse(self.no_response.has_responded()) | ||
|
||
def test_returned_data(self): | ||
self.assertEqual(self.lwolfe_response.user_response["timestamp"], '2/5/2020 15:20:48') | ||
self.assertEqual(self.lwolfe_response.user_response["email"], '[email protected]') | ||
self.assertEqual(self.lwolfe_response.user_response["name"], 'Lauren Wolfe') | ||
self.assertEqual(self.lwolfe_response.user_response["affiliation"], 'ISB-CGC') | ||
self.assertEqual(self.lwolfe_response.user_response["comments"], None) | ||
self.assertEqual(self.lwolfe2_response.user_response["comments"], "Test comments") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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
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