migrate ib posts to aux table
This commit is contained in:
@@ -12,6 +12,15 @@ end
|
||||
describe Domain::Inkbunny::Job::StaticFileJob do
|
||||
let(:http_client_mock) { instance_double("::Scraper::HttpClient") }
|
||||
before { Scraper::ClientFactory.http_client_mock = http_client_mock }
|
||||
let(:creator) do
|
||||
create(:domain_user_inkbunny_user, ib_id: 12_345, name: "TheUser")
|
||||
end
|
||||
let(:post) do
|
||||
create(:domain_post_inkbunny_post, ib_id: 67_891).tap do |p|
|
||||
p.creator = creator
|
||||
p.save!
|
||||
end
|
||||
end
|
||||
let(:file) do
|
||||
Domain::PostFile::InkbunnyPostFile.create!(
|
||||
{
|
||||
@@ -25,15 +34,7 @@ describe Domain::Inkbunny::Job::StaticFileJob do
|
||||
md5s: {
|
||||
initial_file_md5: FileJobSpec::AN_IMAGE_MD5,
|
||||
},
|
||||
post:
|
||||
Domain::Post::InkbunnyPost.create!(
|
||||
ib_id: 67_891,
|
||||
creator:
|
||||
Domain::User::InkbunnyUser.create!(
|
||||
ib_id: 12_345,
|
||||
name: "TheUser",
|
||||
),
|
||||
),
|
||||
post: post,
|
||||
},
|
||||
)
|
||||
end
|
||||
|
||||
@@ -40,42 +40,54 @@ describe Domain::Inkbunny::Job::UpdatePostsJob do
|
||||
end
|
||||
|
||||
let!(:post_3104202) do
|
||||
Domain::Post::InkbunnyPost.create!(
|
||||
ib_id: 3_104_202,
|
||||
creator: user_thendyart,
|
||||
title: "Phantom Touch - Page 25",
|
||||
posted_at: Time.parse("2023-08-27 21:31:40.365597+02"),
|
||||
last_file_updated_at: Time.parse("2023-08-27 21:30:06.222262+02"),
|
||||
num_files: 1,
|
||||
rating: "adult",
|
||||
submission_type: "comic",
|
||||
)
|
||||
Domain::Post::InkbunnyPost
|
||||
.create!(
|
||||
ib_id: 3_104_202,
|
||||
title: "Phantom Touch - Page 25",
|
||||
posted_at: Time.parse("2023-08-27 21:31:40.365597+02"),
|
||||
last_file_updated_at: Time.parse("2023-08-27 21:30:06.222262+02"),
|
||||
num_files: 1,
|
||||
rating: "adult",
|
||||
submission_type: "comic",
|
||||
)
|
||||
.tap do |p|
|
||||
p.creator = user_thendyart
|
||||
p.save!
|
||||
end
|
||||
end
|
||||
|
||||
let!(:post_3104200) do
|
||||
Domain::Post::InkbunnyPost.create!(
|
||||
ib_id: 3_104_200,
|
||||
creator: user_seff,
|
||||
title: "Camp Pines Sketch Dump (Aug 2023)",
|
||||
posted_at: Time.parse("2023-08-27 21:30:59.308046+02"),
|
||||
last_file_updated_at: Time.parse("2023-08-27 21:26:14.049+02"),
|
||||
num_files: 4,
|
||||
rating: "adult",
|
||||
submission_type: "picture_pinup",
|
||||
)
|
||||
Domain::Post::InkbunnyPost
|
||||
.create!(
|
||||
ib_id: 3_104_200,
|
||||
title: "Camp Pines Sketch Dump (Aug 2023)",
|
||||
posted_at: Time.parse("2023-08-27 21:30:59.308046+02"),
|
||||
last_file_updated_at: Time.parse("2023-08-27 21:26:14.049+02"),
|
||||
num_files: 4,
|
||||
rating: "adult",
|
||||
submission_type: "picture_pinup",
|
||||
)
|
||||
.tap do |p|
|
||||
p.creator = user_seff
|
||||
p.save!
|
||||
end
|
||||
end
|
||||
|
||||
let!(:post_3104197) do
|
||||
Domain::Post::InkbunnyPost.create!(
|
||||
ib_id: 3_104_197,
|
||||
creator: user_soulcentinel,
|
||||
title: "Comm - BJ bird",
|
||||
posted_at: Time.parse("2023-08-27 21:29:37.995264+02"),
|
||||
last_file_updated_at: Time.parse("2023-08-27 21:24:23.653306+02"),
|
||||
num_files: 1,
|
||||
rating: "adult",
|
||||
submission_type: "picture_pinup",
|
||||
)
|
||||
Domain::Post::InkbunnyPost
|
||||
.create!(
|
||||
ib_id: 3_104_197,
|
||||
title: "Comm - BJ bird",
|
||||
posted_at: Time.parse("2023-08-27 21:29:37.995264+02"),
|
||||
last_file_updated_at: Time.parse("2023-08-27 21:24:23.653306+02"),
|
||||
num_files: 1,
|
||||
rating: "adult",
|
||||
submission_type: "picture_pinup",
|
||||
)
|
||||
.tap do |p|
|
||||
p.creator = user_soulcentinel
|
||||
p.save!
|
||||
end
|
||||
end
|
||||
|
||||
let(:ib_post_ids) { [3_104_202, 3_104_200, 3_104_197] }
|
||||
@@ -349,16 +361,20 @@ describe Domain::Inkbunny::Job::UpdatePostsJob do
|
||||
end
|
||||
|
||||
let!(:post_1047334) do
|
||||
Domain::Post::InkbunnyPost.create!(
|
||||
ib_id: 1_047_334,
|
||||
creator: user_zzreg,
|
||||
title: "New Submission",
|
||||
posted_at: Time.parse("2016-03-13 22:18:52.32319+01"),
|
||||
last_file_updated_at: Time.parse("2016-03-13 22:18:52.32319+01"),
|
||||
num_files: 1,
|
||||
rating: "general",
|
||||
submission_type: "picture_pinup",
|
||||
)
|
||||
Domain::Post::InkbunnyPost
|
||||
.create!(
|
||||
ib_id: 1_047_334,
|
||||
title: "New Submission",
|
||||
posted_at: Time.parse("2016-03-13 22:18:52.32319+01"),
|
||||
last_file_updated_at: Time.parse("2016-03-13 22:18:52.32319+01"),
|
||||
num_files: 1,
|
||||
rating: "general",
|
||||
submission_type: "picture_pinup",
|
||||
)
|
||||
.tap do |p|
|
||||
p.creator = user_zzreg
|
||||
p.save!
|
||||
end
|
||||
end
|
||||
|
||||
it "updates post with new file information" do
|
||||
@@ -440,9 +456,11 @@ describe Domain::Inkbunny::Job::UpdatePostsJob do
|
||||
create(
|
||||
:domain_post_inkbunny_post,
|
||||
ib_id: 2_637_105,
|
||||
creator: user_friar,
|
||||
num_files: 5,
|
||||
)
|
||||
).tap do |p|
|
||||
p.creator = user_friar
|
||||
p.save!
|
||||
end
|
||||
end
|
||||
|
||||
it "handles files with null MD5 sums correctly" do
|
||||
|
||||
Reference in New Issue
Block a user