{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/comments/40754645","id":40754645,"diff_hunk":"@@ -0,0 +1,94 @@\n+from nose.tools import raises, with_setup, assert_equals\n+from remotespark.RemoteSparkMagics import RemoteSparkMagics\n+from mock import MagicMock\n+\n+ip = get_ipython()\n+magic = None\n+\n+def _setup():\n+\tglobal magic\n+\tmagic = RemoteSparkMagics(shell=ip)\n+\tip.register_magics(magic)\n+\n+def _teardown():\n+\tpass\n+\n+@with_setup(_setup, _teardown)\n+def test_info_command():\n+\tmock_method = MagicMock()\n+\tmagic._print_info = mock_method\n+\tcommand = \"info\"\n+\n+\tip.run_line_magic(\"spark\", command)\n+\n+\tmock_method.assert_called_with()\n+\n+@with_setup(_setup, _teardown)\n+def test_add_endpoint_command():\n+\tmock_method = MagicMock()\n+\tmagic.add_endpoint = mock_method\n+\tcommand = \"add\"\n+\tname = \"name\"\n+\tlanguage = \"python\"\n+\tconnection_string = \"url=http://location:port;username=name;password=word\"\n+\tline = \" \".join([command, name, language, connection_string])\n+\n+\tip.run_line_magic(\"spark\", line)\n+\n+\tmock_method.assert_called_with(name, language, connection_string)\n+\n+\n+@with_setup(_setup, _teardown)\n+def test_delete_endpoint_command():\n+\tmock_method = MagicMock()\n+\tmagic.delete_endpoint = mock_method\n+\tcommand = \"delete\"\n+\tname = \"name\"\n+\tline = \" \".join([command, name])\n+\n+\tip.run_line_magic(\"spark\", line)\n+\n+\tmock_method.assert_called_with(name)\n+\n+@with_setup(_setup, _teardown)\n+def test_mode_command():\n+\tmock_method = MagicMock()\n+\tmagic.log_mode = mock_method\n+\tcommand = \"mode\"\n+\tmode = \"debug\"\n+\n+\tline = \" \".join([command, mode])\n+\n+\tip.run_line_magic(\"spark\", line)\n+\n+\tmock_method.assert_called_with(mode)\n+\n+@with_setup(_setup, _teardown)\n+def test_cleanup_command():\n+\tmock_method = MagicMock()\n+\tmagic.cleanup = mock_method\n+\tcommand = \"cleanup\"\n+\n+\tip.run_line_magic(\"spark\", command)\n+\n+\tmock_method.assert_called_with()","path":"tests/test_remotesparkmagics.py","position":74,"original_position":74,"commit_id":"0740b854415107e7bd7c19e82eb81c5f51abf967","original_commit_id":"888aa1a8863af7f53d4affcd3c5c14dff2ad14d6","user":{"login":"aggFTW","id":654204,"avatar_url":"https://avatars.githubusercontent.com/u/654204?v=3","gravatar_id":"","url":"https://api.github.com/users/aggFTW","html_url":"https://github.com/aggFTW","followers_url":"https://api.github.com/users/aggFTW/followers","following_url":"https://api.github.com/users/aggFTW/following{/other_user}","gists_url":"https://api.github.com/users/aggFTW/gists{/gist_id}","starred_url":"https://api.github.com/users/aggFTW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aggFTW/subscriptions","organizations_url":"https://api.github.com/users/aggFTW/orgs","repos_url":"https://api.github.com/users/aggFTW/repos","events_url":"https://api.github.com/users/aggFTW/events{/privacy}","received_events_url":"https://api.github.com/users/aggFTW/received_events","type":"User","site_admin":false},"body":"Yes, I agree it's more pythonic. Your call. I don't have strong feelings on this case.","created_at":"2015-09-30T03:01:48Z","updated_at":"2015-09-30T03:01:48Z","html_url":"https://github.com/jupyter-incubator/sparkmagic/pull/19#discussion_r40754645","pull_request_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/comments/40754645"},"html":{"href":"https://github.com/jupyter-incubator/sparkmagic/pull/19#discussion_r40754645"},"pull_request":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19","id":46354687,"html_url":"https://github.com/jupyter-incubator/sparkmagic/pull/19","diff_url":"https://github.com/jupyter-incubator/sparkmagic/pull/19.diff","patch_url":"https://github.com/jupyter-incubator/sparkmagic/pull/19.patch","issue_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/19","number":19,"state":"open","locked":false,"title":"Merged magics","user":{"login":"alope107","id":9411388,"avatar_url":"https://avatars.githubusercontent.com/u/9411388?v=3","gravatar_id":"","url":"https://api.github.com/users/alope107","html_url":"https://github.com/alope107","followers_url":"https://api.github.com/users/alope107/followers","following_url":"https://api.github.com/users/alope107/following{/other_user}","gists_url":"https://api.github.com/users/alope107/gists{/gist_id}","starred_url":"https://api.github.com/users/alope107/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alope107/subscriptions","organizations_url":"https://api.github.com/users/alope107/orgs","repos_url":"https://api.github.com/users/alope107/repos","events_url":"https://api.github.com/users/alope107/events{/privacy}","received_events_url":"https://api.github.com/users/alope107/received_events","type":"User","site_admin":false},"body":"Merged the two magics into a single magic named %%spark. Factored out logic into separate methods for easier testing and so that they may be called by an alternate interface, like the planned widgets. Added tests for command parsing. Will need additional testing for actual functionality, and example notebook will need to be redone.","created_at":"2015-09-30T02:15:39Z","updated_at":"2015-09-30T03:01:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b1d159ff8b57b063c076e6b800bbeb55c0e1fa86","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19/commits","review_comments_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19/comments","review_comment_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/19/comments","statuses_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/statuses/0740b854415107e7bd7c19e82eb81c5f51abf967","head":{"label":"alope107:languageRefactor","ref":"languageRefactor","sha":"0740b854415107e7bd7c19e82eb81c5f51abf967","user":{"login":"alope107","id":9411388,"avatar_url":"https://avatars.githubusercontent.com/u/9411388?v=3","gravatar_id":"","url":"https://api.github.com/users/alope107","html_url":"https://github.com/alope107","followers_url":"https://api.github.com/users/alope107/followers","following_url":"https://api.github.com/users/alope107/following{/other_user}","gists_url":"https://api.github.com/users/alope107/gists{/gist_id}","starred_url":"https://api.github.com/users/alope107/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alope107/subscriptions","organizations_url":"https://api.github.com/users/alope107/orgs","repos_url":"https://api.github.com/users/alope107/repos","events_url":"https://api.github.com/users/alope107/events{/privacy}","received_events_url":"https://api.github.com/users/alope107/received_events","type":"User","site_admin":false},"repo":{"id":43028199,"name":"sparkmagic","full_name":"alope107/sparkmagic","owner":{"login":"alope107","id":9411388,"avatar_url":"https://avatars.githubusercontent.com/u/9411388?v=3","gravatar_id":"","url":"https://api.github.com/users/alope107","html_url":"https://github.com/alope107","followers_url":"https://api.github.com/users/alope107/followers","following_url":"https://api.github.com/users/alope107/following{/other_user}","gists_url":"https://api.github.com/users/alope107/gists{/gist_id}","starred_url":"https://api.github.com/users/alope107/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alope107/subscriptions","organizations_url":"https://api.github.com/users/alope107/orgs","repos_url":"https://api.github.com/users/alope107/repos","events_url":"https://api.github.com/users/alope107/events{/privacy}","received_events_url":"https://api.github.com/users/alope107/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alope107/sparkmagic","description":"IPython magics for working with remote Spark clusters","fork":true,"url":"https://api.github.com/repos/alope107/sparkmagic","forks_url":"https://api.github.com/repos/alope107/sparkmagic/forks","keys_url":"https://api.github.com/repos/alope107/sparkmagic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alope107/sparkmagic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alope107/sparkmagic/teams","hooks_url":"https://api.github.com/repos/alope107/sparkmagic/hooks","issue_events_url":"https://api.github.com/repos/alope107/sparkmagic/issues/events{/number}","events_url":"https://api.github.com/repos/alope107/sparkmagic/events","assignees_url":"https://api.github.com/repos/alope107/sparkmagic/assignees{/user}","branches_url":"https://api.github.com/repos/alope107/sparkmagic/branches{/branch}","tags_url":"https://api.github.com/repos/alope107/sparkmagic/tags","blobs_url":"https://api.github.com/repos/alope107/sparkmagic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alope107/sparkmagic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alope107/sparkmagic/git/refs{/sha}","trees_url":"https://api.github.com/repos/alope107/sparkmagic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alope107/sparkmagic/statuses/{sha}","languages_url":"https://api.github.com/repos/alope107/sparkmagic/languages","stargazers_url":"https://api.github.com/repos/alope107/sparkmagic/stargazers","contributors_url":"https://api.github.com/repos/alope107/sparkmagic/contributors","subscribers_url":"https://api.github.com/repos/alope107/sparkmagic/subscribers","subscription_url":"https://api.github.com/repos/alope107/sparkmagic/subscription","commits_url":"https://api.github.com/repos/alope107/sparkmagic/commits{/sha}","git_commits_url":"https://api.github.com/repos/alope107/sparkmagic/git/commits{/sha}","comments_url":"https://api.github.com/repos/alope107/sparkmagic/comments{/number}","issue_comment_url":"https://api.github.com/repos/alope107/sparkmagic/issues/comments{/number}","contents_url":"https://api.github.com/repos/alope107/sparkmagic/contents/{+path}","compare_url":"https://api.github.com/repos/alope107/sparkmagic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alope107/sparkmagic/merges","archive_url":"https://api.github.com/repos/alope107/sparkmagic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alope107/sparkmagic/downloads","issues_url":"https://api.github.com/repos/alope107/sparkmagic/issues{/number}","pulls_url":"https://api.github.com/repos/alope107/sparkmagic/pulls{/number}","milestones_url":"https://api.github.com/repos/alope107/sparkmagic/milestones{/number}","notifications_url":"https://api.github.com/repos/alope107/sparkmagic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alope107/sparkmagic/labels{/name}","releases_url":"https://api.github.com/repos/alope107/sparkmagic/releases{/id}","created_at":"2015-09-23T21:31:28Z","updated_at":"2015-09-23T21:31:29Z","pushed_at":"2015-09-30T02:39:35Z","git_url":"git://github.com/alope107/sparkmagic.git","ssh_url":"git@github.com:alope107/sparkmagic.git","clone_url":"https://github.com/alope107/sparkmagic.git","svn_url":"https://github.com/alope107/sparkmagic","homepage":null,"size":92,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter-incubator:master","ref":"master","sha":"e6c237ca58681f4bbb989d4ff2f4c3d047864472","user":{"login":"jupyter-incubator","id":14002361,"avatar_url":"https://avatars.githubusercontent.com/u/14002361?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter-incubator","html_url":"https://github.com/jupyter-incubator","followers_url":"https://api.github.com/users/jupyter-incubator/followers","following_url":"https://api.github.com/users/jupyter-incubator/following{/other_user}","gists_url":"https://api.github.com/users/jupyter-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter-incubator/subscriptions","organizations_url":"https://api.github.com/users/jupyter-incubator/orgs","repos_url":"https://api.github.com/users/jupyter-incubator/repos","events_url":"https://api.github.com/users/jupyter-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter-incubator/received_events","type":"Organization","site_admin":false},"repo":{"id":42875585,"name":"sparkmagic","full_name":"jupyter-incubator/sparkmagic","owner":{"login":"jupyter-incubator","id":14002361,"avatar_url":"https://avatars.githubusercontent.com/u/14002361?v=3","gravatar_id":"","url":"https://api.github.com/users/jupyter-incubator","html_url":"https://github.com/jupyter-incubator","followers_url":"https://api.github.com/users/jupyter-incubator/followers","following_url":"https://api.github.com/users/jupyter-incubator/following{/other_user}","gists_url":"https://api.github.com/users/jupyter-incubator/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter-incubator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter-incubator/subscriptions","organizations_url":"https://api.github.com/users/jupyter-incubator/orgs","repos_url":"https://api.github.com/users/jupyter-incubator/repos","events_url":"https://api.github.com/users/jupyter-incubator/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter-incubator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jupyter-incubator/sparkmagic","description":"IPython magics for working with remote Spark clusters","fork":false,"url":"https://api.github.com/repos/jupyter-incubator/sparkmagic","forks_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/forks","keys_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/teams","hooks_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/hooks","issue_events_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/events","assignees_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/tags","blobs_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/languages","stargazers_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/stargazers","contributors_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/contributors","subscribers_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/subscribers","subscription_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/subscription","commits_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/merges","archive_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/downloads","issues_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/labels{/name}","releases_url":"https://api.github.com/repos/jupyter-incubator/sparkmagic/releases{/id}","created_at":"2015-09-21T15:35:25Z","updated_at":"2015-09-29T05:53:57Z","pushed_at":"2015-09-30T02:39:36Z","git_url":"git://github.com/jupyter-incubator/sparkmagic.git","ssh_url":"git@github.com:jupyter-incubator/sparkmagic.git","clone_url":"https://github.com/jupyter-incubator/sparkmagic.git","svn_url":"https://github.com/jupyter-incubator/sparkmagic","homepage":null,"size":231,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19"},"html":{"href":"https://github.com/jupyter-incubator/sparkmagic/pull/19"},"issue":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/19"},"comments":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter-incubator/sparkmagic/statuses/0740b854415107e7bd7c19e82eb81c5f51abf967"}}}}