GitHub PullRequestReviewCommentEvent at 2014-10-01 08:50:37
Repository: ralph_assets
Actor: xliiv
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/allegro/ralph_assets/pulls/comments/18267223","id":18267223,"diff_hunk":"@@ -107,6 +111,80 @@ def test_service_name(self):\n \n         self.assertNotEqual(old_service, self.licence.service_name)\n \n+    def test_assign_asset_to_licence(self):\n+        \"\"\"Simple assign asset to licence.\"\"\"\n+        asset = AssetFactory()\n+        self.licence.assign(obj=asset)\n+        self.assertEqual(LicenceAsset.objects.all().count(), 1)\n+        self.assertEqual(LicenceAsset.objects.all()[0].quantity, 1)\n+        self.assertEqual(self.licence.used, 1)\n+\n+    def test_assign_asset_to_support(self):\n+        \"\"\"Assign not supported object to licence.\"\"\"\n+        asset = DCSupportFactory()\n+        with self.assertRaises(Exception):\n+            self.licence.assign(obj=asset)\n+\n+    def test_assign_asset_to_licence_zero_quantity(self):\n+        \"\"\"Simple assign asset to licence with zero quantity.\"\"\"\n+        asset = AssetFactory()\n+        with self.assertRaises(ValueError):\n+            self.licence.assign(obj=asset, quantity=0)\n+\n+    def test_update_assign_asset_to_licence(self):\n+        \"\"\"Simple update assign asset to licence.\"\"\"\n+        asset = AssetFactory()\n+        self.licence.assign(obj=asset)\n+        self.assertEqual(LicenceAsset.objects.all().count(), 1)\n+        self.assertEqual(LicenceAsset.objects.all()[0].quantity, 1)\n+        self.assertEqual(self.licence.used, 1)\n+\n+        self.licence = Licence.objects.get(pk=self.licence.pk)\n+        self.licence.assign(obj=asset, quantity=10)\n+        self.assertEqual(LicenceAsset.objects.all().count(), 1)\n+        self.assertEqual(LicenceAsset.objects.all()[0].quantity, 10)\n+        self.assertEqual(self.licence.used, 10)\n+\n+    def test_assign_asset_to_licence_custom_number_of_used(self):\n+        \"\"\"Simple assign asset to licence with custom number of used.\"\"\"\n+        asset = AssetFactory()\n+        consume_by_asset = 5\n+        self.licence.assign(obj=asset, quantity=consume_by_asset)\n+        self.assertEqual(LicenceAsset.objects.all().count(), 1)\n+        self.assertEqual(\n+            LicenceAsset.objects.all()[0].quantity, consume_by_asset\n+        )\n+        self.assertEqual(self.licence.used, consume_by_asset)\n+\n+    def test_detach(self):\n+        \"\"\"Detach asset from licence.\"\"\"\n+        asset = AssetFactory()\n+        self.licence.assign(obj=asset)\n+        self.licence.detach(obj=asset)\n+        self.assertEqual(LicenceAsset.objects.all().count(), 0)\n+        self.assertEqual(self.licence.used, 0)\n+\n+    def test_detach_does_not_exist(self):\n+        \"\"\"Detach asset from licence but licence doesn't assgin to asset.\"\"\"\n+        asset = AssetFactory()\n+        self.licence.detach(obj=asset)\n+        self.assertEqual(LicenceAsset.objects.all().count(), 0)\n+        self.assertEqual(self.licence.used, 0)\n+\n+    @skip('TODO')","path":"src/ralph_assets/tests/unit/tests_models.py","position":90,"original_position":90,"commit_id":"ba95f9425da84f609c99f6eb6587c3e495836d8e","original_commit_id":"ba95f9425da84f609c99f6eb6587c3e495836d8e","user":{"login":"xliiv","id":298994,"avatar_url":"https://avatars.githubusercontent.com/u/298994?v=2","gravatar_id":"","url":"https://api.github.com/users/xliiv","html_url":"https://github.com/xliiv","followers_url":"https://api.github.com/users/xliiv/followers","following_url":"https://api.github.com/users/xliiv/following{/other_user}","gists_url":"https://api.github.com/users/xliiv/gists{/gist_id}","starred_url":"https://api.github.com/users/xliiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xliiv/subscriptions","organizations_url":"https://api.github.com/users/xliiv/orgs","repos_url":"https://api.github.com/users/xliiv/repos","events_url":"https://api.github.com/users/xliiv/events{/privacy}","received_events_url":"https://api.github.com/users/xliiv/received_events","type":"User","site_admin":false},"body":"when this can be executed?","created_at":"2014-10-01T08:50:37Z","updated_at":"2014-10-01T08:50:37Z","html_url":"https://github.com/allegro/ralph_assets/pull/460#discussion_r18267223","pull_request_url":"https://api.github.com/repos/allegro/ralph_assets/pulls/460","_links":{"self":{"href":"https://api.github.com/repos/allegro/ralph_assets/pulls/comments/18267223"},"html":{"href":"https://github.com/allegro/ralph_assets/pull/460#discussion_r18267223"},"pull_request":{"href":"https://api.github.com/repos/allegro/ralph_assets/pulls/460"}}},"pull_request":{"url":"https://api.github.com/repos/allegro/ralph_assets/pulls/460","id":21997988,"html_url":"https://github.com/allegro/ralph_assets/pull/460","diff_url":"https://github.com/allegro/ralph_assets/pull/460.diff","patch_url":"https://github.com/allegro/ralph_assets/pull/460.patch","issue_url":"https://api.github.com/repos/allegro/ralph_assets/issues/460","number":460,"state":"open","locked":false,"title":"Multi item licence","user":{"login":"ar4s","id":351535,"avatar_url":"https://avatars.githubusercontent.com/u/351535?v=2","gravatar_id":"","url":"https://api.github.com/users/ar4s","html_url":"https://github.com/ar4s","followers_url":"https://api.github.com/users/ar4s/followers","following_url":"https://api.github.com/users/ar4s/following{/other_user}","gists_url":"https://api.github.com/users/ar4s/gists{/gist_id}","starred_url":"https://api.github.com/users/ar4s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ar4s/subscriptions","organizations_url":"https://api.github.com/users/ar4s/orgs","repos_url":"https://api.github.com/users/ar4s/repos","events_url":"https://api.github.com/users/ar4s/events{/privacy}","received_events_url":"https://api.github.com/users/ar4s/received_events","type":"User","site_admin":false},"body":"Changes:\r\n- licences quantity assigned to (asset|user)\r\n![image](https://cloud.githubusercontent.com/assets/351535/4457415/b844f976-4896-11e4-8fe3-f366598c4a3e.png)\r\n\r\n@xliiv @quamilek please review.\r\n","created_at":"2014-09-30T11:42:22Z","updated_at":"2014-10-01T08:50:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12de8394b02a994d8e7a0249417339dd9d8abe05","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/allegro/ralph_assets/pulls/460/commits","review_comments_url":"https://api.github.com/repos/allegro/ralph_assets/pulls/460/comments","review_comment_url":"https://api.github.com/repos/allegro/ralph_assets/pulls/comments/{number}","comments_url":"https://api.github.com/repos/allegro/ralph_assets/issues/460/comments","statuses_url":"https://api.github.com/repos/allegro/ralph_assets/statuses/ba95f9425da84f609c99f6eb6587c3e495836d8e","head":{"label":"ar4s:multi-item-licence","ref":"multi-item-licence","sha":"ba95f9425da84f609c99f6eb6587c3e495836d8e","user":{"login":"ar4s","id":351535,"avatar_url":"https://avatars.githubusercontent.com/u/351535?v=2","gravatar_id":"","url":"https://api.github.com/users/ar4s","html_url":"https://github.com/ar4s","followers_url":"https://api.github.com/users/ar4s/followers","following_url":"https://api.github.com/users/ar4s/following{/other_user}","gists_url":"https://api.github.com/users/ar4s/gists{/gist_id}","starred_url":"https://api.github.com/users/ar4s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ar4s/subscriptions","organizations_url":"https://api.github.com/users/ar4s/orgs","repos_url":"https://api.github.com/users/ar4s/repos","events_url":"https://api.github.com/users/ar4s/events{/privacy}","received_events_url":"https://api.github.com/users/ar4s/received_events","type":"User","site_admin":false},"repo":{"id":19569879,"name":"ralph_assets","full_name":"ar4s/ralph_assets","owner":{"login":"ar4s","id":351535,"avatar_url":"https://avatars.githubusercontent.com/u/351535?v=2","gravatar_id":"","url":"https://api.github.com/users/ar4s","html_url":"https://github.com/ar4s","followers_url":"https://api.github.com/users/ar4s/followers","following_url":"https://api.github.com/users/ar4s/following{/other_user}","gists_url":"https://api.github.com/users/ar4s/gists{/gist_id}","starred_url":"https://api.github.com/users/ar4s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ar4s/subscriptions","organizations_url":"https://api.github.com/users/ar4s/orgs","repos_url":"https://api.github.com/users/ar4s/repos","events_url":"https://api.github.com/users/ar4s/events{/privacy}","received_events_url":"https://api.github.com/users/ar4s/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ar4s/ralph_assets","description":"Assets Management module for Ralph","fork":true,"url":"https://api.github.com/repos/ar4s/ralph_assets","forks_url":"https://api.github.com/repos/ar4s/ralph_assets/forks","keys_url":"https://api.github.com/repos/ar4s/ralph_assets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ar4s/ralph_assets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ar4s/ralph_assets/teams","hooks_url":"https://api.github.com/repos/ar4s/ralph_assets/hooks","issue_events_url":"https://api.github.com/repos/ar4s/ralph_assets/issues/events{/number}","events_url":"https://api.github.com/repos/ar4s/ralph_assets/events","assignees_url":"https://api.github.com/repos/ar4s/ralph_assets/assignees{/user}","branches_url":"https://api.github.com/repos/ar4s/ralph_assets/branches{/branch}","tags_url":"https://api.github.com/repos/ar4s/ralph_assets/tags","blobs_url":"https://api.github.com/repos/ar4s/ralph_assets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ar4s/ralph_assets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ar4s/ralph_assets/git/refs{/sha}","trees_url":"https://api.github.com/repos/ar4s/ralph_assets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ar4s/ralph_assets/statuses/{sha}","languages_url":"https://api.github.com/repos/ar4s/ralph_assets/languages","stargazers_url":"https://api.github.com/repos/ar4s/ralph_assets/stargazers","contributors_url":"https://api.github.com/repos/ar4s/ralph_assets/contributors","subscribers_url":"https://api.github.com/repos/ar4s/ralph_assets/subscribers","subscription_url":"https://api.github.com/repos/ar4s/ralph_assets/subscription","commits_url":"https://api.github.com/repos/ar4s/ralph_assets/commits{/sha}","git_commits_url":"https://api.github.com/repos/ar4s/ralph_assets/git/commits{/sha}","comments_url":"https://api.github.com/repos/ar4s/ralph_assets/comments{/number}","issue_comment_url":"https://api.github.com/repos/ar4s/ralph_assets/issues/comments/{number}","contents_url":"https://api.github.com/repos/ar4s/ralph_assets/contents/{+path}","compare_url":"https://api.github.com/repos/ar4s/ralph_assets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ar4s/ralph_assets/merges","archive_url":"https://api.github.com/repos/ar4s/ralph_assets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ar4s/ralph_assets/downloads","issues_url":"https://api.github.com/repos/ar4s/ralph_assets/issues{/number}","pulls_url":"https://api.github.com/repos/ar4s/ralph_assets/pulls{/number}","milestones_url":"https://api.github.com/repos/ar4s/ralph_assets/milestones{/number}","notifications_url":"https://api.github.com/repos/ar4s/ralph_assets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ar4s/ralph_assets/labels{/name}","releases_url":"https://api.github.com/repos/ar4s/ralph_assets/releases{/id}","created_at":"2014-05-08T10:38:59Z","updated_at":"2014-06-25T13:55:55Z","pushed_at":"2014-10-01T06:53:45Z","git_url":"git://github.com/ar4s/ralph_assets.git","ssh_url":"git@github.com:ar4s/ralph_assets.git","clone_url":"https://github.com/ar4s/ralph_assets.git","svn_url":"https://github.com/ar4s/ralph_assets","homepage":"","size":6223,"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":"develop"}},"base":{"label":"allegro:develop","ref":"develop","sha":"7e66dd5995c6bfff178f6ecf92c7744f36af614f","user":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=2","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"repo":{"id":8750311,"name":"ralph_assets","full_name":"allegro/ralph_assets","owner":{"login":"allegro","id":562236,"avatar_url":"https://avatars.githubusercontent.com/u/562236?v=2","gravatar_id":"","url":"https://api.github.com/users/allegro","html_url":"https://github.com/allegro","followers_url":"https://api.github.com/users/allegro/followers","following_url":"https://api.github.com/users/allegro/following{/other_user}","gists_url":"https://api.github.com/users/allegro/gists{/gist_id}","starred_url":"https://api.github.com/users/allegro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allegro/subscriptions","organizations_url":"https://api.github.com/users/allegro/orgs","repos_url":"https://api.github.com/users/allegro/repos","events_url":"https://api.github.com/users/allegro/events{/privacy}","received_events_url":"https://api.github.com/users/allegro/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/allegro/ralph_assets","description":"Assets Management module for Ralph","fork":false,"url":"https://api.github.com/repos/allegro/ralph_assets","forks_url":"https://api.github.com/repos/allegro/ralph_assets/forks","keys_url":"https://api.github.com/repos/allegro/ralph_assets/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allegro/ralph_assets/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allegro/ralph_assets/teams","hooks_url":"https://api.github.com/repos/allegro/ralph_assets/hooks","issue_events_url":"https://api.github.com/repos/allegro/ralph_assets/issues/events{/number}","events_url":"https://api.github.com/repos/allegro/ralph_assets/events","assignees_url":"https://api.github.com/repos/allegro/ralph_assets/assignees{/user}","branches_url":"https://api.github.com/repos/allegro/ralph_assets/branches{/branch}","tags_url":"https://api.github.com/repos/allegro/ralph_assets/tags","blobs_url":"https://api.github.com/repos/allegro/ralph_assets/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allegro/ralph_assets/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allegro/ralph_assets/git/refs{/sha}","trees_url":"https://api.github.com/repos/allegro/ralph_assets/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allegro/ralph_assets/statuses/{sha}","languages_url":"https://api.github.com/repos/allegro/ralph_assets/languages","stargazers_url":"https://api.github.com/repos/allegro/ralph_assets/stargazers","contributors_url":"https://api.github.com/repos/allegro/ralph_assets/contributors","subscribers_url":"https://api.github.com/repos/allegro/ralph_assets/subscribers","subscription_url":"https://api.github.com/repos/allegro/ralph_assets/subscription","commits_url":"https://api.github.com/repos/allegro/ralph_assets/commits{/sha}","git_commits_url":"https://api.github.com/repos/allegro/ralph_assets/git/commits{/sha}","comments_url":"https://api.github.com/repos/allegro/ralph_assets/comments{/number}","issue_comment_url":"https://api.github.com/repos/allegro/ralph_assets/issues/comments/{number}","contents_url":"https://api.github.com/repos/allegro/ralph_assets/contents/{+path}","compare_url":"https://api.github.com/repos/allegro/ralph_assets/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allegro/ralph_assets/merges","archive_url":"https://api.github.com/repos/allegro/ralph_assets/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allegro/ralph_assets/downloads","issues_url":"https://api.github.com/repos/allegro/ralph_assets/issues{/number}","pulls_url":"https://api.github.com/repos/allegro/ralph_assets/pulls{/number}","milestones_url":"https://api.github.com/repos/allegro/ralph_assets/milestones{/number}","notifications_url":"https://api.github.com/repos/allegro/ralph_assets/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allegro/ralph_assets/labels{/name}","releases_url":"https://api.github.com/repos/allegro/ralph_assets/releases{/id}","created_at":"2013-03-13T10:58:38Z","updated_at":"2014-09-03T12:16:27Z","pushed_at":"2014-09-30T12:24:43Z","git_url":"git://github.com/allegro/ralph_assets.git","ssh_url":"git@github.com:allegro/ralph_assets.git","clone_url":"https://github.com/allegro/ralph_assets.git","svn_url":"https://github.com/allegro/ralph_assets","homepage":"","size":12487,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":2,"forks":17,"open_issues":2,"watchers":7,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/allegro/ralph_assets/pulls/460"},"html":{"href":"https://github.com/allegro/ralph_assets/pull/460"},"issue":{"href":"https://api.github.com/repos/allegro/ralph_assets/issues/460"},"comments":{"href":"https://api.github.com/repos/allegro/ralph_assets/issues/460/comments"},"review_comments":{"href":"https://api.github.com/repos/allegro/ralph_assets/pulls/460/comments"},"review_comment":{"href":"https://api.github.com/repos/allegro/ralph_assets/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/allegro/ralph_assets/pulls/460/commits"},"statuses":{"href":"https://api.github.com/repos/allegro/ralph_assets/statuses/ba95f9425da84f609c99f6eb6587c3e495836d8e"}}}}