{"action":"created","comment":{"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments/44794111","id":44794111,"diff_hunk":"@@ -0,0 +1,194 @@\n+import os\n+from unittest.mock import patch\n+\n+from django.core.exceptions import ValidationError\n+from django.test import TestCase\n+\n+from conversion_job.models import Extent, ConversionJob, GISFormat\n+from converters import converter_settings, converter_options\n+from converters.boundaries import BBox\n+from shared import ConversionProgress\n+\n+\n+class ExtentTest(TestCase):\n+    def test_validation_raised_in_clean(self):\n+        e = Extent()\n+        self.assertFalse(e._bbox_present())\n+        self.assertFalse(e._polyfile_present())\n+        self.assertRaisesRegex(ValidationError, r'either .* or .* must be given', e.clean)\n+\n+    def test_validation_raises_when_both_present(self):\n+        e = Extent(west=0, south=0, east=0, north=0, polyfile='present')\n+        self.assertTrue(e._bbox_present())\n+        self.assertTrue(e._polyfile_present())\n+        self.assertRaisesRegex(ValidationError, r'either .* or .* must be given', e.clean)\n+\n+    def test_validation_raises_with_incomplete_bbox(self):\n+        e = Extent(west=0, east=0)\n+        self.assertFalse(e._bbox_present())\n+        self.assertFalse(e._polyfile_present())\n+        self.assertRaisesRegex(ValidationError, r'incomplete .* boundaries', e.clean)\n+\n+    def test_validation_raises_with_polyfile_and_incomplete_bbox(self):\n+        e = Extent(west=0, east=0, polyfile='present')\n+        self.assertFalse(e._bbox_present())\n+        self.assertTrue(e._polyfile_present())\n+        self.assertRaisesRegex(ValidationError, r'either .* or .* must be given|incomplete .* boundaries', e.clean)\n+\n+    def test_validation_passes_with_bbox(self):\n+        e = Extent(west=0, south=0, east=0, north=0)\n+        self.assertTrue(e._bbox_present())\n+        self.assertFalse(e._polyfile_present())\n+        # no exception expected\n+        e.clean()\n+\n+    def test_validation_passes_with_polyfile(self):\n+        e = Extent(polyfile='present')\n+        self.assertFalse(e._bbox_present())\n+        self.assertTrue(e._polyfile_present())\n+        # no exception expected\n+        e.clean()\n+\n+    def test_get_geometry_returns_geometry(self):\n+        e = Extent(west=0, south=0, east=0, north=0)\n+        self.assertEqual(e.get_geometry().__dict__, BBox(west=0, south=0, east=0, north=0).__dict__)\n+\n+    def test_get_geometry_raises_with_polyfile_for_now(self):\n+        e = Extent(polyfile='present')\n+        self.assertRaises(NotImplementedError, e.get_geometry)\n+\n+    @patch('conversion_job.models.Extent.clean')\n+    def test_save_calls_clean_method(self, clean_mock):\n+        e = Extent(polyfile='present')\n+        e.save()\n+        clean_mock.assert_called_once_with()\n+\n+    def test_save_call_succeeds_with_polyfile(self):\n+        e = Extent(polyfile='present')\n+        # no exception expected\n+        e.save()\n+\n+    def test_save_call_succeeds_with_bbox(self):\n+        e = Extent(west=0, south=0, east=0, north=0)\n+        # no exception expected\n+        e.save()\n+\n+\n+class ConversionJobTest(TestCase):\n+    def test_output_directory_is_created_if_not_exists(self):\n+        extent = Extent.objects.create(west=0, south=0, east=0, north=0)\n+        conversion_job = ConversionJob(extent=extent)\n+        conversion_job.save()","path":"tests/conversion_job/model_test.py","position":null,"original_position":81,"commit_id":"ee14b8c1bcf06df3e8595c0c0711ae313e8b2e3a","original_commit_id":"c3c9ba8c6dedb692804301ef33786fb786c704fd","user":{"login":"das-g","id":97746,"avatar_url":"https://avatars.githubusercontent.com/u/97746?v=3","gravatar_id":"","url":"https://api.github.com/users/das-g","html_url":"https://github.com/das-g","followers_url":"https://api.github.com/users/das-g/followers","following_url":"https://api.github.com/users/das-g/following{/other_user}","gists_url":"https://api.github.com/users/das-g/gists{/gist_id}","starred_url":"https://api.github.com/users/das-g/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/das-g/subscriptions","organizations_url":"https://api.github.com/users/das-g/orgs","repos_url":"https://api.github.com/users/das-g/repos","events_url":"https://api.github.com/users/das-g/events{/privacy}","received_events_url":"https://api.github.com/users/das-g/received_events","type":"User","site_admin":false},"body":":white_check_mark: done with  b770b0d","created_at":"2015-11-13T15:31:21Z","updated_at":"2015-11-13T15:31:21Z","html_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/40#discussion_r44794111","pull_request_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments/44794111"},"html":{"href":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/40#discussion_r44794111"},"pull_request":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40","id":50248291,"html_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/40","diff_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/40.diff","patch_url":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/40.patch","issue_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/40","number":40,"state":"open","locked":false,"title":"Feature/244 conversion job manager","user":{"login":"hixi","id":97119,"avatar_url":"https://avatars.githubusercontent.com/u/97119?v=3","gravatar_id":"","url":"https://api.github.com/users/hixi","html_url":"https://github.com/hixi","followers_url":"https://api.github.com/users/hixi/followers","following_url":"https://api.github.com/users/hixi/following{/other_user}","gists_url":"https://api.github.com/users/hixi/gists{/gist_id}","starred_url":"https://api.github.com/users/hixi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hixi/subscriptions","organizations_url":"https://api.github.com/users/hixi/orgs","repos_url":"https://api.github.com/users/hixi/repos","events_url":"https://api.github.com/users/hixi/events{/privacy}","received_events_url":"https://api.github.com/users/hixi/received_events","type":"User","site_admin":false},"body":"conversion job manager and some tests for it.\r\n\r\n```bash\r\n./runtests.py # success\r\ntox # success\r\n```\r\n\r\nCloses geometalab/osmaxx#244","created_at":"2015-11-10T12:33:42Z","updated_at":"2015-11-13T15:31:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cdba3e8d491fcfb7dd2923686d29e3b030c0d193","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40/commits","review_comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40/comments","review_comment_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/40/comments","statuses_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/ee14b8c1bcf06df3e8595c0c0711ae313e8b2e3a","head":{"label":"geometalab:feature/244_conversion_job_manager","ref":"feature/244_conversion_job_manager","sha":"ee14b8c1bcf06df3e8595c0c0711ae313e8b2e3a","user":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"repo":{"id":36354077,"name":"osmaxx-postgis-conversion","full_name":"geometalab/osmaxx-postgis-conversion","owner":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geometalab/osmaxx-postgis-conversion","description":"Downloads OSM data, imports it into PostgreSQL, transforms it, exports it into various formats","fork":false,"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion","forks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/forks","keys_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/teams","hooks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/hooks","issue_events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/events{/number}","events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/events","assignees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/assignees{/user}","branches_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/branches{/branch}","tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/tags","blobs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/refs{/sha}","trees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/{sha}","languages_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/languages","stargazers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/stargazers","contributors_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contributors","subscribers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscribers","subscription_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscription","commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/commits{/sha}","git_commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/commits{/sha}","comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/comments{/number}","issue_comment_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/comments{/number}","contents_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contents/{+path}","compare_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/merges","archive_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/downloads","issues_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues{/number}","pulls_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls{/number}","milestones_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/milestones{/number}","notifications_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/labels{/name}","releases_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/releases{/id}","created_at":"2015-05-27T08:35:02Z","updated_at":"2015-08-18T09:18:04Z","pushed_at":"2015-11-13T14:42:06Z","git_url":"git://github.com/geometalab/osmaxx-postgis-conversion.git","ssh_url":"git@github.com:geometalab/osmaxx-postgis-conversion.git","clone_url":"https://github.com/geometalab/osmaxx-postgis-conversion.git","svn_url":"https://github.com/geometalab/osmaxx-postgis-conversion","homepage":null,"size":1560,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"develop"}},"base":{"label":"geometalab:develop","ref":"develop","sha":"c5478c537c2097cbfe7d262f6317a279963c5852","user":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"repo":{"id":36354077,"name":"osmaxx-postgis-conversion","full_name":"geometalab/osmaxx-postgis-conversion","owner":{"login":"geometalab","id":8266374,"avatar_url":"https://avatars.githubusercontent.com/u/8266374?v=3","gravatar_id":"","url":"https://api.github.com/users/geometalab","html_url":"https://github.com/geometalab","followers_url":"https://api.github.com/users/geometalab/followers","following_url":"https://api.github.com/users/geometalab/following{/other_user}","gists_url":"https://api.github.com/users/geometalab/gists{/gist_id}","starred_url":"https://api.github.com/users/geometalab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geometalab/subscriptions","organizations_url":"https://api.github.com/users/geometalab/orgs","repos_url":"https://api.github.com/users/geometalab/repos","events_url":"https://api.github.com/users/geometalab/events{/privacy}","received_events_url":"https://api.github.com/users/geometalab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geometalab/osmaxx-postgis-conversion","description":"Downloads OSM data, imports it into PostgreSQL, transforms it, exports it into various formats","fork":false,"url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion","forks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/forks","keys_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/teams","hooks_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/hooks","issue_events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/events{/number}","events_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/events","assignees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/assignees{/user}","branches_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/branches{/branch}","tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/tags","blobs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/refs{/sha}","trees_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/{sha}","languages_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/languages","stargazers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/stargazers","contributors_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contributors","subscribers_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscribers","subscription_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/subscription","commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/commits{/sha}","git_commits_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/git/commits{/sha}","comments_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/comments{/number}","issue_comment_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/comments{/number}","contents_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/contents/{+path}","compare_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/merges","archive_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/downloads","issues_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues{/number}","pulls_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls{/number}","milestones_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/milestones{/number}","notifications_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/labels{/name}","releases_url":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/releases{/id}","created_at":"2015-05-27T08:35:02Z","updated_at":"2015-08-18T09:18:04Z","pushed_at":"2015-11-13T14:42:06Z","git_url":"git://github.com/geometalab/osmaxx-postgis-conversion.git","ssh_url":"git@github.com:geometalab/osmaxx-postgis-conversion.git","clone_url":"https://github.com/geometalab/osmaxx-postgis-conversion.git","svn_url":"https://github.com/geometalab/osmaxx-postgis-conversion","homepage":null,"size":1560,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40"},"html":{"href":"https://github.com/geometalab/osmaxx-postgis-conversion/pull/40"},"issue":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/40"},"comments":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/geometalab/osmaxx-postgis-conversion/statuses/ee14b8c1bcf06df3e8595c0c0711ae313e8b2e3a"}}}}