Use an invalid domain for fake email addresses in importers

Use an invalid domain for fake email addresses in importers

diff --git a/script/import_scripts/askbot.rb b/script/import_scripts/askbot.rb
index ac409a6..b4cb4f2 100644
--- a/script/import_scripts/askbot.rb
+++ b/script/import_scripts/askbot.rb
@@ -118,7 +118,7 @@ class ImportScripts::MyAskBot < ImportScripts::Base
         {
           id: user["id"],
           username: user["username"],
-          email: user["email"] || (SecureRandom.hex << "@domain.com"),
+          email: user["email"] || fake_email,
           admin: user["is_staff"],
           created_at: Time.zone.at(@td.decode(user["date_joined"])),
           last_seen_at: Time.zone.at(@td.decode(user["last_seen"])),
diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb
index 77abd75..944f26c 100644
--- a/script/import_scripts/base.rb
+++ b/script/import_scripts/base.rb
@@ -883,6 +883,6 @@ class ImportScripts::Base
   end
 
   def fake_email
-    SecureRandom.hex << "@domain.com"
+    SecureRandom.hex << "@email.invalid"
   end
 end
diff --git a/script/import_scripts/bespoke_1.rb b/script/import_scripts/bespoke_1.rb
index 8ddb8bf..8f36db0 100644
--- a/script/import_scripts/bespoke_1.rb
+++ b/script/import_scripts/bespoke_1.rb
@@ -139,7 +139,7 @@ class ImportScripts::Bespoke < ImportScripts::Base
 
       # fake it
       if row.email.blank? || row.email !~ /@/
-        email = SecureRandom.hex << "@domain.com"
+        email = fake_email
       end
 
       name = row.display_name
diff --git a/script/import_scripts/jive.rb b/script/import_scripts/jive.rb
index 4b253fe..c70b3e0 100644
--- a/script/import_scripts/jive.rb
+++ b/script/import_scripts/jive.rb
@@ -154,7 +154,7 @@ class ImportScripts::Jive < ImportScripts::Base
 
       # fake it
       if row.email.blank? || row.email !~ /@/
-        email = SecureRandom.hex << "@domain.com"
+        email = fake_email
       end
 
       name = "#{row.firstname} #{row.lastname}"
diff --git a/script/import_scripts/nabble.rb b/script/import_scripts/nabble.rb
index 05533da..e405486 100644
--- a/script/import_scripts/nabble.rb
+++ b/script/import_scripts/nabble.rb
@@ -80,7 +80,7 @@ class ImportScripts::Nabble < ImportScripts::Base
       create_users(users, total: total_count, offset: offset) do |row|
         {
           id: row["user_id"],
-          email: row["email"] || (SecureRandom.hex << "@domain.com"),
+          email: row["email"] || fake_email,
           created_at: Time.zone.at(@td.decode(row["joined"])),
           name: row["name"],
           post_create_action: proc do |user|

GitHub sha: c70d0c66

1 Like