このコミットが含まれているのは:
@@ -171,3 +171,33 @@ RSpec.describe 'Counts export contracts' do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.describe 'Counts download acknowledgement' do
|
||||
around do |example|
|
||||
Dir.mktmpdir('counts-ack-spec') do |path|
|
||||
allow(CountsExportDownload).to receive(:directory).and_return(Pathname.new(path))
|
||||
HistoryAccess.set(user: nil) { example.run }
|
||||
end
|
||||
end
|
||||
|
||||
it 'binds an acknowledgement to the owner, job, file token and fresh attempt' do
|
||||
CountsExportJobs.pulse
|
||||
payload = { 'resource' => 'posts', 'definition' => 'history', 'mode' => 'details',
|
||||
'format' => 'json', 'locale' => 'ja' }
|
||||
token = CountsExportJobs.start(payload, 'owner', 'ja')
|
||||
id = CountsExportJobs.authorised_id(token, 'owner')
|
||||
state = CountsExportJobs.read(id).merge('status' => 'ready', 'token' => 'file-token')
|
||||
CountsExportJobs.write(state)
|
||||
receipt = CountsExportJobs.download_attempt(token, 'owner')
|
||||
expect(receipt['download_status']).to eq('pending')
|
||||
arguments = { file_token: 'file-token', attempt: receipt.fetch('download_attempt') }
|
||||
expect(CountsExportJobs.download_attempt(token, 'other', **arguments)).to be_nil
|
||||
expect(CountsExportJobs.download_attempt(token, 'owner', **arguments.merge(file_token: 'wrong'))).to be_nil
|
||||
CountsExportJobs.download_attempt(token, 'owner', **arguments, status: 'started')
|
||||
expect(CountsExportJobs.status(token, 'owner')['download_status']).to eq('started')
|
||||
CountsExportJobs.download_attempt(token, 'owner')
|
||||
expect(CountsExportJobs.download_attempt(token, 'owner', **arguments)).to be_nil
|
||||
CountsExportJobs.status(token, 'owner', cancel: true)
|
||||
expect(CountsExportJobs.download_attempt(token, 'owner')).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする