{"action":"created","comment":{"url":"https://api.github.com/repos/projecthydra/sufia/pulls/comments/83870231","pull_request_review_id":4684460,"id":83870231,"diff_hunk":"@@ -0,0 +1,48 @@\n+require 'spec_helper'\n+\n+describe Sufia::Import::GenericFileTranslator do\n+  let(:sufia6_user) { \"s6user\" }\n+  let(:sufia6_password) { \"s6password\" }\n+  let(:translator) { described_class.new(sufia6_user: sufia6_user, sufia6_password: sufia6_password) }\n+\n+  let(:import_directory) { File.join(fixture_path, 'import') }\n+  let(:gf_metadata) { JSON.parse(File.read(File.join(import_directory, \"generic_file_#{work_id}.json\")), symbolize_names: true) }\n+  let(:work) { Sufia.primary_work_type.find(work_id) }\n+  # used to retrieve the fixture and then test that the object was created with the same id\n+  let(:work_id) { 'qr46r0963' }\n+\n+  let(:permission_builder) { instance_double(Sufia::Import::PermissionBuilder) }\n+  let(:version_builder) { instance_double(Sufia::Import::VersionBuilder) }\n+  before do\n+    allow(Sufia::Import::PermissionBuilder).to receive(:new).and_return(permission_builder)\n+    allow(Sufia::Import::VersionBuilder).to receive(:new).and_return(version_builder)\n+    allow(permission_builder).to receive(:build).and_return([])\n+    allow(version_builder).to receive(:build).and_return([])\n+  end\n+\n+  describe '#import' do\n+    it 'Creates a work with attached fileset' do\n+      expect(Sufia.primary_work_type.count).to eq 0\n+      expect(FileSet.count).to eq 0\n+      translator.import(import_directory, 'generic_file_')\n+      expect(Sufia.primary_work_type.count).to eq 1\n+      expect(FileSet.count).to eq 1\n+      expect(work.members.one?).to be true\n+      expect(work.title).to include 'Myth'\n+    end\n+\n+    it 'Errors when passed a nonexistent directory' do\n+      expect { translator.import('totallynotadirectory', 'whatever') }.to raise_error RuntimeError\n+    end\n+\n+    describe 'in verbose mode' do\n+      before do\n+        translator.verbose = true\n+      end\n+      it 'Prints info' do\n+        expect(STDOUT).to receive(:puts).with(\"Importing generic_file_qr46r0963.json\")","path":"spec/lib/sufia/import/generic_file_translator_spec.rb","position":43,"original_position":43,"commit_id":"b63c29b9306108a3c845cbdc85c21f8ca41bf4c5","original_commit_id":"b63c29b9306108a3c845cbdc85c21f8ca41bf4c5","user":{"login":"cam156","id":1599081,"avatar_url":"https://avatars.githubusercontent.com/u/1599081?v=3","gravatar_id":"","url":"https://api.github.com/users/cam156","html_url":"https://github.com/cam156","followers_url":"https://api.github.com/users/cam156/followers","following_url":"https://api.github.com/users/cam156/following{/other_user}","gists_url":"https://api.github.com/users/cam156/gists{/gist_id}","starred_url":"https://api.github.com/users/cam156/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cam156/subscriptions","organizations_url":"https://api.github.com/users/cam156/orgs","repos_url":"https://api.github.com/users/cam156/repos","events_url":"https://api.github.com/users/cam156/events{/privacy}","received_events_url":"https://api.github.com/users/cam156/received_events","type":"User","site_admin":false},"body":"@hackmastera This would change to  `expect(Rails.logger).to receive(:debug)`","created_at":"2016-10-18T14:44:05Z","updated_at":"2016-10-18T14:44:05Z","html_url":"https://github.com/projecthydra/sufia/pull/2786#discussion_r83870231","pull_request_url":"https://api.github.com/repos/projecthydra/sufia/pulls/2786","_links":{"self":{"href":"https://api.github.com/repos/projecthydra/sufia/pulls/comments/83870231"},"html":{"href":"https://github.com/projecthydra/sufia/pull/2786#discussion_r83870231"},"pull_request":{"href":"https://api.github.com/repos/projecthydra/sufia/pulls/2786"}}},"pull_request":{"url":"https://api.github.com/repos/projecthydra/sufia/pulls/2786","id":89256455,"html_url":"https://github.com/projecthydra/sufia/pull/2786","diff_url":"https://github.com/projecthydra/sufia/pull/2786.diff","patch_url":"https://github.com/projecthydra/sufia/pull/2786.patch","issue_url":"https://api.github.com/repos/projecthydra/sufia/issues/2786","number":2786,"state":"open","locked":false,"title":"[WIP] Add Sufia::Import::GenericFileTranslator","user":{"login":"hackmastera","id":845363,"avatar_url":"https://avatars.githubusercontent.com/u/845363?v=3","gravatar_id":"","url":"https://api.github.com/users/hackmastera","html_url":"https://github.com/hackmastera","followers_url":"https://api.github.com/users/hackmastera/followers","following_url":"https://api.github.com/users/hackmastera/following{/other_user}","gists_url":"https://api.github.com/users/hackmastera/gists{/gist_id}","starred_url":"https://api.github.com/users/hackmastera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hackmastera/subscriptions","organizations_url":"https://api.github.com/users/hackmastera/orgs","repos_url":"https://api.github.com/users/hackmastera/repos","events_url":"https://api.github.com/users/hackmastera/events{/privacy}","received_events_url":"https://api.github.com/users/hackmastera/received_events","type":"User","site_admin":false},"body":"@cam156 or others; anything else you would like to see tested? Other comments so far?","created_at":"2016-10-13T18:28:32Z","updated_at":"2016-10-18T14:44:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eba9bdd83434d4bd2e0f3b02baa2371bcf817bb3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/projecthydra/sufia/pulls/2786/commits","review_comments_url":"https://api.github.com/repos/projecthydra/sufia/pulls/2786/comments","review_comment_url":"https://api.github.com/repos/projecthydra/sufia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projecthydra/sufia/issues/2786/comments","statuses_url":"https://api.github.com/repos/projecthydra/sufia/statuses/b63c29b9306108a3c845cbdc85c21f8ca41bf4c5","head":{"label":"projecthydra:gf-translator","ref":"gf-translator","sha":"b63c29b9306108a3c845cbdc85c21f8ca41bf4c5","user":{"login":"projecthydra","id":109426,"avatar_url":"https://avatars.githubusercontent.com/u/109426?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra","html_url":"https://github.com/projecthydra","followers_url":"https://api.github.com/users/projecthydra/followers","following_url":"https://api.github.com/users/projecthydra/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra/subscriptions","organizations_url":"https://api.github.com/users/projecthydra/orgs","repos_url":"https://api.github.com/users/projecthydra/repos","events_url":"https://api.github.com/users/projecthydra/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra/received_events","type":"Organization","site_admin":false},"repo":{"id":7653178,"name":"sufia","full_name":"projecthydra/sufia","owner":{"login":"projecthydra","id":109426,"avatar_url":"https://avatars.githubusercontent.com/u/109426?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra","html_url":"https://github.com/projecthydra","followers_url":"https://api.github.com/users/projecthydra/followers","following_url":"https://api.github.com/users/projecthydra/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra/subscriptions","organizations_url":"https://api.github.com/users/projecthydra/orgs","repos_url":"https://api.github.com/users/projecthydra/repos","events_url":"https://api.github.com/users/projecthydra/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projecthydra/sufia","description":"Sufia: a fully featured, flexible Hydra repository front-end.","fork":false,"url":"https://api.github.com/repos/projecthydra/sufia","forks_url":"https://api.github.com/repos/projecthydra/sufia/forks","keys_url":"https://api.github.com/repos/projecthydra/sufia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projecthydra/sufia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projecthydra/sufia/teams","hooks_url":"https://api.github.com/repos/projecthydra/sufia/hooks","issue_events_url":"https://api.github.com/repos/projecthydra/sufia/issues/events{/number}","events_url":"https://api.github.com/repos/projecthydra/sufia/events","assignees_url":"https://api.github.com/repos/projecthydra/sufia/assignees{/user}","branches_url":"https://api.github.com/repos/projecthydra/sufia/branches{/branch}","tags_url":"https://api.github.com/repos/projecthydra/sufia/tags","blobs_url":"https://api.github.com/repos/projecthydra/sufia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projecthydra/sufia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projecthydra/sufia/git/refs{/sha}","trees_url":"https://api.github.com/repos/projecthydra/sufia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projecthydra/sufia/statuses/{sha}","languages_url":"https://api.github.com/repos/projecthydra/sufia/languages","stargazers_url":"https://api.github.com/repos/projecthydra/sufia/stargazers","contributors_url":"https://api.github.com/repos/projecthydra/sufia/contributors","subscribers_url":"https://api.github.com/repos/projecthydra/sufia/subscribers","subscription_url":"https://api.github.com/repos/projecthydra/sufia/subscription","commits_url":"https://api.github.com/repos/projecthydra/sufia/commits{/sha}","git_commits_url":"https://api.github.com/repos/projecthydra/sufia/git/commits{/sha}","comments_url":"https://api.github.com/repos/projecthydra/sufia/comments{/number}","issue_comment_url":"https://api.github.com/repos/projecthydra/sufia/issues/comments{/number}","contents_url":"https://api.github.com/repos/projecthydra/sufia/contents/{+path}","compare_url":"https://api.github.com/repos/projecthydra/sufia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projecthydra/sufia/merges","archive_url":"https://api.github.com/repos/projecthydra/sufia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projecthydra/sufia/downloads","issues_url":"https://api.github.com/repos/projecthydra/sufia/issues{/number}","pulls_url":"https://api.github.com/repos/projecthydra/sufia/pulls{/number}","milestones_url":"https://api.github.com/repos/projecthydra/sufia/milestones{/number}","notifications_url":"https://api.github.com/repos/projecthydra/sufia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projecthydra/sufia/labels{/name}","releases_url":"https://api.github.com/repos/projecthydra/sufia/releases{/id}","deployments_url":"https://api.github.com/repos/projecthydra/sufia/deployments","created_at":"2013-01-16T20:23:18Z","updated_at":"2016-10-17T19:08:31Z","pushed_at":"2016-10-18T14:12:18Z","git_url":"git://github.com/projecthydra/sufia.git","ssh_url":"git@github.com:projecthydra/sufia.git","clone_url":"https://github.com/projecthydra/sufia.git","svn_url":"https://github.com/projecthydra/sufia","homepage":"http://sufia.io/","size":57299,"stargazers_count":107,"watchers_count":107,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":214,"forks":88,"open_issues":214,"watchers":107,"default_branch":"master"}},"base":{"label":"projecthydra:7.2-migration","ref":"7.2-migration","sha":"eff8cdbdd15f94dd8381c589fd4cff1db0994f99","user":{"login":"projecthydra","id":109426,"avatar_url":"https://avatars.githubusercontent.com/u/109426?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra","html_url":"https://github.com/projecthydra","followers_url":"https://api.github.com/users/projecthydra/followers","following_url":"https://api.github.com/users/projecthydra/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra/subscriptions","organizations_url":"https://api.github.com/users/projecthydra/orgs","repos_url":"https://api.github.com/users/projecthydra/repos","events_url":"https://api.github.com/users/projecthydra/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra/received_events","type":"Organization","site_admin":false},"repo":{"id":7653178,"name":"sufia","full_name":"projecthydra/sufia","owner":{"login":"projecthydra","id":109426,"avatar_url":"https://avatars.githubusercontent.com/u/109426?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra","html_url":"https://github.com/projecthydra","followers_url":"https://api.github.com/users/projecthydra/followers","following_url":"https://api.github.com/users/projecthydra/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra/subscriptions","organizations_url":"https://api.github.com/users/projecthydra/orgs","repos_url":"https://api.github.com/users/projecthydra/repos","events_url":"https://api.github.com/users/projecthydra/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projecthydra/sufia","description":"Sufia: a fully featured, flexible Hydra repository front-end.","fork":false,"url":"https://api.github.com/repos/projecthydra/sufia","forks_url":"https://api.github.com/repos/projecthydra/sufia/forks","keys_url":"https://api.github.com/repos/projecthydra/sufia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projecthydra/sufia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projecthydra/sufia/teams","hooks_url":"https://api.github.com/repos/projecthydra/sufia/hooks","issue_events_url":"https://api.github.com/repos/projecthydra/sufia/issues/events{/number}","events_url":"https://api.github.com/repos/projecthydra/sufia/events","assignees_url":"https://api.github.com/repos/projecthydra/sufia/assignees{/user}","branches_url":"https://api.github.com/repos/projecthydra/sufia/branches{/branch}","tags_url":"https://api.github.com/repos/projecthydra/sufia/tags","blobs_url":"https://api.github.com/repos/projecthydra/sufia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projecthydra/sufia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projecthydra/sufia/git/refs{/sha}","trees_url":"https://api.github.com/repos/projecthydra/sufia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projecthydra/sufia/statuses/{sha}","languages_url":"https://api.github.com/repos/projecthydra/sufia/languages","stargazers_url":"https://api.github.com/repos/projecthydra/sufia/stargazers","contributors_url":"https://api.github.com/repos/projecthydra/sufia/contributors","subscribers_url":"https://api.github.com/repos/projecthydra/sufia/subscribers","subscription_url":"https://api.github.com/repos/projecthydra/sufia/subscription","commits_url":"https://api.github.com/repos/projecthydra/sufia/commits{/sha}","git_commits_url":"https://api.github.com/repos/projecthydra/sufia/git/commits{/sha}","comments_url":"https://api.github.com/repos/projecthydra/sufia/comments{/number}","issue_comment_url":"https://api.github.com/repos/projecthydra/sufia/issues/comments{/number}","contents_url":"https://api.github.com/repos/projecthydra/sufia/contents/{+path}","compare_url":"https://api.github.com/repos/projecthydra/sufia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projecthydra/sufia/merges","archive_url":"https://api.github.com/repos/projecthydra/sufia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projecthydra/sufia/downloads","issues_url":"https://api.github.com/repos/projecthydra/sufia/issues{/number}","pulls_url":"https://api.github.com/repos/projecthydra/sufia/pulls{/number}","milestones_url":"https://api.github.com/repos/projecthydra/sufia/milestones{/number}","notifications_url":"https://api.github.com/repos/projecthydra/sufia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projecthydra/sufia/labels{/name}","releases_url":"https://api.github.com/repos/projecthydra/sufia/releases{/id}","deployments_url":"https://api.github.com/repos/projecthydra/sufia/deployments","created_at":"2013-01-16T20:23:18Z","updated_at":"2016-10-17T19:08:31Z","pushed_at":"2016-10-18T14:12:18Z","git_url":"git://github.com/projecthydra/sufia.git","ssh_url":"git@github.com:projecthydra/sufia.git","clone_url":"https://github.com/projecthydra/sufia.git","svn_url":"https://github.com/projecthydra/sufia","homepage":"http://sufia.io/","size":57299,"stargazers_count":107,"watchers_count":107,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":88,"mirror_url":null,"open_issues_count":214,"forks":88,"open_issues":214,"watchers":107,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projecthydra/sufia/pulls/2786"},"html":{"href":"https://github.com/projecthydra/sufia/pull/2786"},"issue":{"href":"https://api.github.com/repos/projecthydra/sufia/issues/2786"},"comments":{"href":"https://api.github.com/repos/projecthydra/sufia/issues/2786/comments"},"review_comments":{"href":"https://api.github.com/repos/projecthydra/sufia/pulls/2786/comments"},"review_comment":{"href":"https://api.github.com/repos/projecthydra/sufia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projecthydra/sufia/pulls/2786/commits"},"statuses":{"href":"https://api.github.com/repos/projecthydra/sufia/statuses/b63c29b9306108a3c845cbdc85c21f8ca41bf4c5"}}}}
{"actor":{"display_login":"cam156"}}