{"action":"created","comment":{"url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments/92799072","pull_request_review_id":13320122,"id":92799072,"diff_hunk":"@@ -0,0 +1,327 @@\n+/*\n+ * This file is part of Cockpit.\n+ *\n+ * Copyright (C) 2014 Red Hat, Inc.\n+ *\n+ * Cockpit is free software; you can redistribute it and/or modify it\n+ * under the terms of the GNU Lesser General Public License as published by\n+ * the Free Software Foundation; either version 2.1 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * Cockpit is distributed in the hope that it will be useful, but\n+ * WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with Cockpit; If not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+var utils = require(\"./utils\");\n+var cockpit = require(\"cockpit\");\n+var QUnit = require(\"qunit-tests\");\n+var assert = QUnit;\n+\n+function assert_throws(func, checks) {\n+    assert.expect(checks.length);\n+\n+    checks.forEach(function (c) {\n+        assert.throws(function () {\n+            func(c);\n+        });\n+    });\n+}\n+\n+QUnit.test(\"ip_prefix_from_text\", function() {\n+    var i;\n+\n+    var checks = [\n+        [ \"0\",      0 ],\n+        [ \"12\",    12 ],\n+        [ \" 12  \", 12 ]\n+    ];\n+\n+    assert.expect(checks.length);\n+\n+    checks.forEach(function (c) {\n+        assert.strictEqual(utils.ip_prefix_from_text(c[0]), c[1]);\n+    });\n+});\n+\n+QUnit.test(\"ip_prefix_from_text invalids\", function() {\n+    var checks = [\n+        \"\",\n+        \"-1\",\n+        \"foo\",\n+        \"1foo\",\n+        \"1.5\",\n+        \"1 2 3\"\n+    ];\n+\n+    assert_throws(utils.ip_prefix_from_text, checks);\n+});\n+\n+QUnit.test(\"ip_metric_from_text\", function() {\n+    var i;\n+\n+    var checks = [\n+        [ \"\",       0 ],\n+        [ \"0\",      0 ],\n+        [ \"12\",    12 ],\n+        [ \" 12  \", 12 ]\n+    ];\n+\n+    assert.expect(checks.length);\n+\n+    checks.forEach(function (c) {\n+        assert.strictEqual(utils.ip_metric_from_text(c[0]), c[1]);\n+    });\n+});\n+\n+QUnit.test(\"ip_metric_from_text invalids\", function() {\n+    var checks = [\n+        \"-1\",\n+        \"foo\",\n+        \"1foo\",\n+        \"1.5\",\n+        \"1 2 3\"\n+    ];\n+\n+    assert_throws(utils.ip_metric_from_text, checks);\n+});\n+\n+QUnit.test(\"ip4_to/from_text be\", function() {\n+    var i;\n+\n+    var checks = [\n+        [ \"0.0.0.0\",           0x00000000 ],\n+        [ \"255.255.255.255\",   0xFFFFFFFF ],\n+        [ \"1.2.3.4\",           0x01020304 ],\n+        [ \" 1.2.3.4 \",         0x01020304 ],\n+        [ \" 1 . 2 . 3. 4 \",    0x01020304 ]\n+    ];\n+\n+    assert.expect(2*checks.length);\n+\n+    utils.set_byteorder(\"be\");\n+    checks.forEach(function (c) {\n+        assert.strictEqual(utils.ip4_to_text(c[1]), c[0].replace(/ /g, \"\"));\n+        assert.strictEqual(utils.ip4_from_text(c[0]), c[1]);\n+    });\n+});\n+\n+QUnit.test(\"ip4_to/from_text le\", function() {\n+    var i;","path":"pkg/networkmanager/test-utils.js","position":114,"original_position":114,"commit_id":"ff5616973a12a0d7e532011679373afbb0c946d6","original_commit_id":"ff5616973a12a0d7e532011679373afbb0c946d6","user":{"login":"dperpeet","id":8711649,"avatar_url":"https://avatars.githubusercontent.com/u/8711649?v=3","gravatar_id":"","url":"https://api.github.com/users/dperpeet","html_url":"https://github.com/dperpeet","followers_url":"https://api.github.com/users/dperpeet/followers","following_url":"https://api.github.com/users/dperpeet/following{/other_user}","gists_url":"https://api.github.com/users/dperpeet/gists{/gist_id}","starred_url":"https://api.github.com/users/dperpeet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dperpeet/subscriptions","organizations_url":"https://api.github.com/users/dperpeet/orgs","repos_url":"https://api.github.com/users/dperpeet/repos","events_url":"https://api.github.com/users/dperpeet/events{/privacy}","received_events_url":"https://api.github.com/users/dperpeet/received_events","type":"User","site_admin":false},"body":"unused variable","created_at":"2016-12-16T11:49:32Z","updated_at":"2016-12-16T11:51:05Z","html_url":"https://github.com/cockpit-project/cockpit/pull/5598#discussion_r92799072","pull_request_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598","_links":{"self":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments/92799072"},"html":{"href":"https://github.com/cockpit-project/cockpit/pull/5598#discussion_r92799072"},"pull_request":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598"}}},"pull_request":{"url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598","id":98177746,"html_url":"https://github.com/cockpit-project/cockpit/pull/5598","diff_url":"https://github.com/cockpit-project/cockpit/pull/5598.diff","patch_url":"https://github.com/cockpit-project/cockpit/pull/5598.patch","issue_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/5598","number":5598,"state":"open","locked":false,"title":"networking: Validate textual input better","user":{"login":"mvollmer","id":3228183,"avatar_url":"https://avatars.githubusercontent.com/u/3228183?v=3","gravatar_id":"","url":"https://api.github.com/users/mvollmer","html_url":"https://github.com/mvollmer","followers_url":"https://api.github.com/users/mvollmer/followers","following_url":"https://api.github.com/users/mvollmer/following{/other_user}","gists_url":"https://api.github.com/users/mvollmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mvollmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvollmer/subscriptions","organizations_url":"https://api.github.com/users/mvollmer/orgs","repos_url":"https://api.github.com/users/mvollmer/repos","events_url":"https://api.github.com/users/mvollmer/events{/privacy}","received_events_url":"https://api.github.com/users/mvollmer/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-15T15:58:29Z","updated_at":"2016-12-16T11:51:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74493fa1b30db7550447c6e32501a9d420b15ba3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598/commits","review_comments_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598/comments","review_comment_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/5598/comments","statuses_url":"https://api.github.com/repos/cockpit-project/cockpit/statuses/ff5616973a12a0d7e532011679373afbb0c946d6","head":{"label":"mvollmer:networking-validate-input","ref":"networking-validate-input","sha":"ff5616973a12a0d7e532011679373afbb0c946d6","user":{"login":"mvollmer","id":3228183,"avatar_url":"https://avatars.githubusercontent.com/u/3228183?v=3","gravatar_id":"","url":"https://api.github.com/users/mvollmer","html_url":"https://github.com/mvollmer","followers_url":"https://api.github.com/users/mvollmer/followers","following_url":"https://api.github.com/users/mvollmer/following{/other_user}","gists_url":"https://api.github.com/users/mvollmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mvollmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvollmer/subscriptions","organizations_url":"https://api.github.com/users/mvollmer/orgs","repos_url":"https://api.github.com/users/mvollmer/repos","events_url":"https://api.github.com/users/mvollmer/events{/privacy}","received_events_url":"https://api.github.com/users/mvollmer/received_events","type":"User","site_admin":false},"repo":{"id":20679941,"name":"cockpit","full_name":"mvollmer/cockpit","owner":{"login":"mvollmer","id":3228183,"avatar_url":"https://avatars.githubusercontent.com/u/3228183?v=3","gravatar_id":"","url":"https://api.github.com/users/mvollmer","html_url":"https://github.com/mvollmer","followers_url":"https://api.github.com/users/mvollmer/followers","following_url":"https://api.github.com/users/mvollmer/following{/other_user}","gists_url":"https://api.github.com/users/mvollmer/gists{/gist_id}","starred_url":"https://api.github.com/users/mvollmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mvollmer/subscriptions","organizations_url":"https://api.github.com/users/mvollmer/orgs","repos_url":"https://api.github.com/users/mvollmer/repos","events_url":"https://api.github.com/users/mvollmer/events{/privacy}","received_events_url":"https://api.github.com/users/mvollmer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mvollmer/cockpit","description":"Cockpit, a user interface for GNU/Linux servers","fork":true,"url":"https://api.github.com/repos/mvollmer/cockpit","forks_url":"https://api.github.com/repos/mvollmer/cockpit/forks","keys_url":"https://api.github.com/repos/mvollmer/cockpit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mvollmer/cockpit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mvollmer/cockpit/teams","hooks_url":"https://api.github.com/repos/mvollmer/cockpit/hooks","issue_events_url":"https://api.github.com/repos/mvollmer/cockpit/issues/events{/number}","events_url":"https://api.github.com/repos/mvollmer/cockpit/events","assignees_url":"https://api.github.com/repos/mvollmer/cockpit/assignees{/user}","branches_url":"https://api.github.com/repos/mvollmer/cockpit/branches{/branch}","tags_url":"https://api.github.com/repos/mvollmer/cockpit/tags","blobs_url":"https://api.github.com/repos/mvollmer/cockpit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mvollmer/cockpit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mvollmer/cockpit/git/refs{/sha}","trees_url":"https://api.github.com/repos/mvollmer/cockpit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mvollmer/cockpit/statuses/{sha}","languages_url":"https://api.github.com/repos/mvollmer/cockpit/languages","stargazers_url":"https://api.github.com/repos/mvollmer/cockpit/stargazers","contributors_url":"https://api.github.com/repos/mvollmer/cockpit/contributors","subscribers_url":"https://api.github.com/repos/mvollmer/cockpit/subscribers","subscription_url":"https://api.github.com/repos/mvollmer/cockpit/subscription","commits_url":"https://api.github.com/repos/mvollmer/cockpit/commits{/sha}","git_commits_url":"https://api.github.com/repos/mvollmer/cockpit/git/commits{/sha}","comments_url":"https://api.github.com/repos/mvollmer/cockpit/comments{/number}","issue_comment_url":"https://api.github.com/repos/mvollmer/cockpit/issues/comments{/number}","contents_url":"https://api.github.com/repos/mvollmer/cockpit/contents/{+path}","compare_url":"https://api.github.com/repos/mvollmer/cockpit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mvollmer/cockpit/merges","archive_url":"https://api.github.com/repos/mvollmer/cockpit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mvollmer/cockpit/downloads","issues_url":"https://api.github.com/repos/mvollmer/cockpit/issues{/number}","pulls_url":"https://api.github.com/repos/mvollmer/cockpit/pulls{/number}","milestones_url":"https://api.github.com/repos/mvollmer/cockpit/milestones{/number}","notifications_url":"https://api.github.com/repos/mvollmer/cockpit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mvollmer/cockpit/labels{/name}","releases_url":"https://api.github.com/repos/mvollmer/cockpit/releases{/id}","deployments_url":"https://api.github.com/repos/mvollmer/cockpit/deployments","created_at":"2014-06-10T09:35:54Z","updated_at":"2016-07-01T17:36:24Z","pushed_at":"2016-12-16T11:27:22Z","git_url":"git://github.com/mvollmer/cockpit.git","ssh_url":"git@github.com:mvollmer/cockpit.git","clone_url":"https://github.com/mvollmer/cockpit.git","svn_url":"https://github.com/mvollmer/cockpit","homepage":"http://www.cockpit-project.org/","size":31628,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"cockpit-project:master","ref":"master","sha":"833eb31f2d9ef8c6c466a97d21a221fdb28a9cff","user":{"login":"cockpit-project","id":5765104,"avatar_url":"https://avatars.githubusercontent.com/u/5765104?v=3","gravatar_id":"","url":"https://api.github.com/users/cockpit-project","html_url":"https://github.com/cockpit-project","followers_url":"https://api.github.com/users/cockpit-project/followers","following_url":"https://api.github.com/users/cockpit-project/following{/other_user}","gists_url":"https://api.github.com/users/cockpit-project/gists{/gist_id}","starred_url":"https://api.github.com/users/cockpit-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockpit-project/subscriptions","organizations_url":"https://api.github.com/users/cockpit-project/orgs","repos_url":"https://api.github.com/users/cockpit-project/repos","events_url":"https://api.github.com/users/cockpit-project/events{/privacy}","received_events_url":"https://api.github.com/users/cockpit-project/received_events","type":"Organization","site_admin":false},"repo":{"id":14049216,"name":"cockpit","full_name":"cockpit-project/cockpit","owner":{"login":"cockpit-project","id":5765104,"avatar_url":"https://avatars.githubusercontent.com/u/5765104?v=3","gravatar_id":"","url":"https://api.github.com/users/cockpit-project","html_url":"https://github.com/cockpit-project","followers_url":"https://api.github.com/users/cockpit-project/followers","following_url":"https://api.github.com/users/cockpit-project/following{/other_user}","gists_url":"https://api.github.com/users/cockpit-project/gists{/gist_id}","starred_url":"https://api.github.com/users/cockpit-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cockpit-project/subscriptions","organizations_url":"https://api.github.com/users/cockpit-project/orgs","repos_url":"https://api.github.com/users/cockpit-project/repos","events_url":"https://api.github.com/users/cockpit-project/events{/privacy}","received_events_url":"https://api.github.com/users/cockpit-project/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cockpit-project/cockpit","description":"Cockpit, an admin interface for Linux servers","fork":false,"url":"https://api.github.com/repos/cockpit-project/cockpit","forks_url":"https://api.github.com/repos/cockpit-project/cockpit/forks","keys_url":"https://api.github.com/repos/cockpit-project/cockpit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cockpit-project/cockpit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cockpit-project/cockpit/teams","hooks_url":"https://api.github.com/repos/cockpit-project/cockpit/hooks","issue_events_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/events{/number}","events_url":"https://api.github.com/repos/cockpit-project/cockpit/events","assignees_url":"https://api.github.com/repos/cockpit-project/cockpit/assignees{/user}","branches_url":"https://api.github.com/repos/cockpit-project/cockpit/branches{/branch}","tags_url":"https://api.github.com/repos/cockpit-project/cockpit/tags","blobs_url":"https://api.github.com/repos/cockpit-project/cockpit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cockpit-project/cockpit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cockpit-project/cockpit/git/refs{/sha}","trees_url":"https://api.github.com/repos/cockpit-project/cockpit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cockpit-project/cockpit/statuses/{sha}","languages_url":"https://api.github.com/repos/cockpit-project/cockpit/languages","stargazers_url":"https://api.github.com/repos/cockpit-project/cockpit/stargazers","contributors_url":"https://api.github.com/repos/cockpit-project/cockpit/contributors","subscribers_url":"https://api.github.com/repos/cockpit-project/cockpit/subscribers","subscription_url":"https://api.github.com/repos/cockpit-project/cockpit/subscription","commits_url":"https://api.github.com/repos/cockpit-project/cockpit/commits{/sha}","git_commits_url":"https://api.github.com/repos/cockpit-project/cockpit/git/commits{/sha}","comments_url":"https://api.github.com/repos/cockpit-project/cockpit/comments{/number}","issue_comment_url":"https://api.github.com/repos/cockpit-project/cockpit/issues/comments{/number}","contents_url":"https://api.github.com/repos/cockpit-project/cockpit/contents/{+path}","compare_url":"https://api.github.com/repos/cockpit-project/cockpit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cockpit-project/cockpit/merges","archive_url":"https://api.github.com/repos/cockpit-project/cockpit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cockpit-project/cockpit/downloads","issues_url":"https://api.github.com/repos/cockpit-project/cockpit/issues{/number}","pulls_url":"https://api.github.com/repos/cockpit-project/cockpit/pulls{/number}","milestones_url":"https://api.github.com/repos/cockpit-project/cockpit/milestones{/number}","notifications_url":"https://api.github.com/repos/cockpit-project/cockpit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cockpit-project/cockpit/labels{/name}","releases_url":"https://api.github.com/repos/cockpit-project/cockpit/releases{/id}","deployments_url":"https://api.github.com/repos/cockpit-project/cockpit/deployments","created_at":"2013-11-01T17:36:46Z","updated_at":"2016-12-14T19:13:14Z","pushed_at":"2016-12-16T11:49:41Z","git_url":"git://github.com/cockpit-project/cockpit.git","ssh_url":"git@github.com:cockpit-project/cockpit.git","clone_url":"https://github.com/cockpit-project/cockpit.git","svn_url":"https://github.com/cockpit-project/cockpit","homepage":"http://www.cockpit-project.org/","size":30044,"stargazers_count":1830,"watchers_count":1830,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":257,"mirror_url":null,"open_issues_count":405,"forks":257,"open_issues":405,"watchers":1830,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598"},"html":{"href":"https://github.com/cockpit-project/cockpit/pull/5598"},"issue":{"href":"https://api.github.com/repos/cockpit-project/cockpit/issues/5598"},"comments":{"href":"https://api.github.com/repos/cockpit-project/cockpit/issues/5598/comments"},"review_comments":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598/comments"},"review_comment":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cockpit-project/cockpit/pulls/5598/commits"},"statuses":{"href":"https://api.github.com/repos/cockpit-project/cockpit/statuses/ff5616973a12a0d7e532011679373afbb0c946d6"}}}}
{"actor":{"display_login":"dperpeet"}}