{"action":"created","comment":{"url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/comments/81836507","pull_request_review_id":2776050,"id":81836507,"diff_hunk":"@@ -0,0 +1,94 @@\n+from copy import deepcopy\n+from unittest.mock import Mock\n+\n+from dataactcore.utils import fileE\n+\n+\n+_VALID_CONFIG = {'sam': {\n+    'wsdl': 'http://example.com', 'username': 'un', 'password': 'pass'}}\n+\n+\n+def test_configValid_empty(monkeypatch):\n+    monkeypatch.setattr(fileE, 'CONFIG_BROKER', {})\n+    assert not fileE.configValid()\n+\n+\n+def test_configValid_complete(monkeypatch):\n+    monkeypatch.setattr(fileE, 'CONFIG_BROKER', _VALID_CONFIG)\n+    assert fileE.configValid()\n+\n+\n+def test_configValid_missing_wsdl(monkeypatch):\n+    config = deepcopy(_VALID_CONFIG)\n+    del config['sam']['wsdl']\n+    monkeypatch.setattr(fileE, 'CONFIG_BROKER', config)\n+    assert not fileE.configValid()\n+\n+\n+def test_configValid_empty_username(monkeypatch):\n+    config = deepcopy(_VALID_CONFIG)\n+    config['sam']['username'] = ''\n+    monkeypatch.setattr(fileE, 'CONFIG_BROKER', config)\n+    assert not fileE.configValid()\n+\n+\n+def test_configValid_password_None(monkeypatch):\n+    config = deepcopy(_VALID_CONFIG)\n+    config['sam']['password'] = None\n+    monkeypatch.setattr(fileE, 'CONFIG_BROKER', config)\n+    assert not fileE.configValid()\n+\n+\n+def make_suds(duns, parent_duns, parent_name):\n+    sudsObj = Mock()\n+    sudsObj.entityIdentification.DUNS = duns\n+    parent = sudsObj.coreData.DUNSInformation.globalParentDUNS\n+    parent.DUNSNumber = parent_duns\n+    parent.legalBusinessName = parent_name\n+    return sudsObj\n+\n+\n+def test_sudsToRow_no_compensation():\n+    sudsObj = make_suds('A Duns', 'Par Duns', 'Par Name')\n+    sudsObj.coreData.listOfExecutiveCompensationInformation = ''\n+    row = fileE.sudsToRow(sudsObj)\n+    assert row == fileE.Row(\n+        'A Duns', 'Par Duns', 'Par Name', '', '', '', '', '', '', '', '',\n+        '', '')\n+\n+\n+def test_sudsToRow_too_few_compensation():\n+    sudsObj = make_suds('B Duns', 'Par DunsB', 'Par NameB')\n+    info = sudsObj.coreData.listOfExecutiveCompensationInformation\n+\n+    middle = Mock(compensation=111.11)\n+    middle.name = 'Middle Person'   # \"name\" is a reserved word\n+    top = Mock(compensation=222.22)\n+    top.name = 'Top Person'\n+    bottom = Mock(compensation=0.0)\n+    bottom.name = 'Bottom Person'\n+\n+    info.executiveCompensationDetail = [middle, top, bottom]\n+    row = fileE.sudsToRow(sudsObj)\n+    assert row == fileE.Row(\n+        'B Duns', 'Par DunsB', 'Par NameB',\n+        'Top Person', 222.22,\n+        'Middle Person', 111.11,\n+        'Bottom Person', 0.0,\n+        '', '', '', '')     # fills out to 5 pairs\n+\n+\n+def test_sudsToRow_too_many_compensation():\n+    sudsObj = make_suds('B Duns', 'Par DunsB', 'Par NameB')\n+    info = sudsObj.coreData.listOfExecutiveCompensationInformation\n+    info.executiveCompensationDetail = [\n+        Mock(compensation=i*11.11) for i in range(1, 10)]\n+    for idx, person in enumerate(info.executiveCompensationDetail):\n+        # Can't do this in the constructor as \"name\" is a reserved word\n+        person.name = \"Person {}\".format(idx + 1)\n+\n+    row = fileE.sudsToRow(sudsObj)\n+    assert row == fileE.Row(\n+        'B Duns', 'Par DunsB', 'Par NameB',\n+        'Person 9', 99.99, 'Person 8', 88.88, 'Person 7', 77.77,\n+        'Person 6', 66.66, 'Person 5', 55.55)","path":"tests/unit/dataactcore/test_utils_fileE.py","position":94,"original_position":94,"commit_id":"550951e3d817a0db63cc64558e5e107556f8604a","original_commit_id":"550951e3d817a0db63cc64558e5e107556f8604a","user":{"login":"jworcestBAH","id":11858333,"avatar_url":"https://avatars.githubusercontent.com/u/11858333?v=3","gravatar_id":"","url":"https://api.github.com/users/jworcestBAH","html_url":"https://github.com/jworcestBAH","followers_url":"https://api.github.com/users/jworcestBAH/followers","following_url":"https://api.github.com/users/jworcestBAH/following{/other_user}","gists_url":"https://api.github.com/users/jworcestBAH/gists{/gist_id}","starred_url":"https://api.github.com/users/jworcestBAH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jworcestBAH/subscriptions","organizations_url":"https://api.github.com/users/jworcestBAH/orgs","repos_url":"https://api.github.com/users/jworcestBAH/repos","events_url":"https://api.github.com/users/jworcestBAH/events{/privacy}","received_events_url":"https://api.github.com/users/jworcestBAH/received_events","type":"User","site_admin":false},"body":"Nice to have these, some very thorough testing going on here.  I'm assuming that for createAuth, createSearch, and getEntities we don't want to mock suds.client.Client in order to test these?","created_at":"2016-10-04T19:39:19Z","updated_at":"2016-10-04T19:42:29Z","html_url":"https://github.com/fedspendingtransparency/data-act-broker-backend/pull/331#discussion_r81836507","pull_request_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331","_links":{"self":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/comments/81836507"},"html":{"href":"https://github.com/fedspendingtransparency/data-act-broker-backend/pull/331#discussion_r81836507"},"pull_request":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331"}}},"pull_request":{"url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331","id":87803435,"html_url":"https://github.com/fedspendingtransparency/data-act-broker-backend/pull/331","diff_url":"https://github.com/fedspendingtransparency/data-act-broker-backend/pull/331.diff","patch_url":"https://github.com/fedspendingtransparency/data-act-broker-backend/pull/331.patch","issue_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/331","number":331,"state":"open","locked":false,"title":"File E generation","user":{"login":"cmc333333","id":326918,"avatar_url":"https://avatars.githubusercontent.com/u/326918?v=3","gravatar_id":"","url":"https://api.github.com/users/cmc333333","html_url":"https://github.com/cmc333333","followers_url":"https://api.github.com/users/cmc333333/followers","following_url":"https://api.github.com/users/cmc333333/following{/other_user}","gists_url":"https://api.github.com/users/cmc333333/gists{/gist_id}","starred_url":"https://api.github.com/users/cmc333333/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmc333333/subscriptions","organizations_url":"https://api.github.com/users/cmc333333/orgs","repos_url":"https://api.github.com/users/cmc333333/repos","events_url":"https://api.github.com/users/cmc333333/events{/privacy}","received_events_url":"https://api.github.com/users/cmc333333/received_events","type":"User","site_admin":false},"body":"Functions to grab file E data from the SAM SOAP endpoints, convert that into the fields we care about, add an asynchronous task for dealing with this processing in the job queue, and connecting all of that to the HTTP `fileHandler` endpoint.\r\n\r\nThis'll probably be review changeset by changeset.","created_at":"2016-10-03T22:26:43Z","updated_at":"2016-10-04T19:42:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf5fba3910f03b5953d7281ebc7819cd8501b18d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331/commits","review_comments_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331/comments","review_comment_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/331/comments","statuses_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/statuses/550951e3d817a0db63cc64558e5e107556f8604a","head":{"label":"fedspendingtransparency:db-1012-gen-file-e","ref":"db-1012-gen-file-e","sha":"550951e3d817a0db63cc64558e5e107556f8604a","user":{"login":"fedspendingtransparency","id":8397762,"avatar_url":"https://avatars.githubusercontent.com/u/8397762?v=3","gravatar_id":"","url":"https://api.github.com/users/fedspendingtransparency","html_url":"https://github.com/fedspendingtransparency","followers_url":"https://api.github.com/users/fedspendingtransparency/followers","following_url":"https://api.github.com/users/fedspendingtransparency/following{/other_user}","gists_url":"https://api.github.com/users/fedspendingtransparency/gists{/gist_id}","starred_url":"https://api.github.com/users/fedspendingtransparency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedspendingtransparency/subscriptions","organizations_url":"https://api.github.com/users/fedspendingtransparency/orgs","repos_url":"https://api.github.com/users/fedspendingtransparency/repos","events_url":"https://api.github.com/users/fedspendingtransparency/events{/privacy}","received_events_url":"https://api.github.com/users/fedspendingtransparency/received_events","type":"Organization","site_admin":false},"repo":{"id":57313310,"name":"data-act-broker-backend","full_name":"fedspendingtransparency/data-act-broker-backend","owner":{"login":"fedspendingtransparency","id":8397762,"avatar_url":"https://avatars.githubusercontent.com/u/8397762?v=3","gravatar_id":"","url":"https://api.github.com/users/fedspendingtransparency","html_url":"https://github.com/fedspendingtransparency","followers_url":"https://api.github.com/users/fedspendingtransparency/followers","following_url":"https://api.github.com/users/fedspendingtransparency/following{/other_user}","gists_url":"https://api.github.com/users/fedspendingtransparency/gists{/gist_id}","starred_url":"https://api.github.com/users/fedspendingtransparency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedspendingtransparency/subscriptions","organizations_url":"https://api.github.com/users/fedspendingtransparency/orgs","repos_url":"https://api.github.com/users/fedspendingtransparency/repos","events_url":"https://api.github.com/users/fedspendingtransparency/events{/privacy}","received_events_url":"https://api.github.com/users/fedspendingtransparency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fedspendingtransparency/data-act-broker-backend","description":"","fork":false,"url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend","forks_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/forks","keys_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/teams","hooks_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/hooks","issue_events_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/events{/number}","events_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/events","assignees_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/assignees{/user}","branches_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/branches{/branch}","tags_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/tags","blobs_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/languages","stargazers_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/stargazers","contributors_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/contributors","subscribers_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/subscribers","subscription_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/subscription","commits_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/contents/{+path}","compare_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/merges","archive_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/downloads","issues_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues{/number}","pulls_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/labels{/name}","releases_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/releases{/id}","deployments_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/deployments","created_at":"2016-04-28T15:39:36Z","updated_at":"2016-08-30T17:03:39Z","pushed_at":"2016-10-04T18:26:37Z","git_url":"git://github.com/fedspendingtransparency/data-act-broker-backend.git","ssh_url":"git@github.com:fedspendingtransparency/data-act-broker-backend.git","clone_url":"https://github.com/fedspendingtransparency/data-act-broker-backend.git","svn_url":"https://github.com/fedspendingtransparency/data-act-broker-backend","homepage":null,"size":54273,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"fedspendingtransparency:development","ref":"development","sha":"1419e8e48609ca2b28a8e0a5541c8f2b50646d89","user":{"login":"fedspendingtransparency","id":8397762,"avatar_url":"https://avatars.githubusercontent.com/u/8397762?v=3","gravatar_id":"","url":"https://api.github.com/users/fedspendingtransparency","html_url":"https://github.com/fedspendingtransparency","followers_url":"https://api.github.com/users/fedspendingtransparency/followers","following_url":"https://api.github.com/users/fedspendingtransparency/following{/other_user}","gists_url":"https://api.github.com/users/fedspendingtransparency/gists{/gist_id}","starred_url":"https://api.github.com/users/fedspendingtransparency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedspendingtransparency/subscriptions","organizations_url":"https://api.github.com/users/fedspendingtransparency/orgs","repos_url":"https://api.github.com/users/fedspendingtransparency/repos","events_url":"https://api.github.com/users/fedspendingtransparency/events{/privacy}","received_events_url":"https://api.github.com/users/fedspendingtransparency/received_events","type":"Organization","site_admin":false},"repo":{"id":57313310,"name":"data-act-broker-backend","full_name":"fedspendingtransparency/data-act-broker-backend","owner":{"login":"fedspendingtransparency","id":8397762,"avatar_url":"https://avatars.githubusercontent.com/u/8397762?v=3","gravatar_id":"","url":"https://api.github.com/users/fedspendingtransparency","html_url":"https://github.com/fedspendingtransparency","followers_url":"https://api.github.com/users/fedspendingtransparency/followers","following_url":"https://api.github.com/users/fedspendingtransparency/following{/other_user}","gists_url":"https://api.github.com/users/fedspendingtransparency/gists{/gist_id}","starred_url":"https://api.github.com/users/fedspendingtransparency/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedspendingtransparency/subscriptions","organizations_url":"https://api.github.com/users/fedspendingtransparency/orgs","repos_url":"https://api.github.com/users/fedspendingtransparency/repos","events_url":"https://api.github.com/users/fedspendingtransparency/events{/privacy}","received_events_url":"https://api.github.com/users/fedspendingtransparency/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fedspendingtransparency/data-act-broker-backend","description":"","fork":false,"url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend","forks_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/forks","keys_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/teams","hooks_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/hooks","issue_events_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/events{/number}","events_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/events","assignees_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/assignees{/user}","branches_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/branches{/branch}","tags_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/tags","blobs_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/languages","stargazers_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/stargazers","contributors_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/contributors","subscribers_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/subscribers","subscription_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/subscription","commits_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/contents/{+path}","compare_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/merges","archive_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/downloads","issues_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues{/number}","pulls_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/labels{/name}","releases_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/releases{/id}","deployments_url":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/deployments","created_at":"2016-04-28T15:39:36Z","updated_at":"2016-08-30T17:03:39Z","pushed_at":"2016-10-04T18:26:37Z","git_url":"git://github.com/fedspendingtransparency/data-act-broker-backend.git","ssh_url":"git@github.com:fedspendingtransparency/data-act-broker-backend.git","clone_url":"https://github.com/fedspendingtransparency/data-act-broker-backend.git","svn_url":"https://github.com/fedspendingtransparency/data-act-broker-backend","homepage":null,"size":54273,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331"},"html":{"href":"https://github.com/fedspendingtransparency/data-act-broker-backend/pull/331"},"issue":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/331"},"comments":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/issues/331/comments"},"review_comments":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331/comments"},"review_comment":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/pulls/331/commits"},"statuses":{"href":"https://api.github.com/repos/fedspendingtransparency/data-act-broker-backend/statuses/550951e3d817a0db63cc64558e5e107556f8604a"}}}}
{"actor":{"display_login":"jworcestBAH"}}