summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-08-06 15:14:52 -0300
committerDuda Dornelles <ddornell@thoughtworks.com>2014-08-06 15:22:19 -0300
commit6ff065504c517acd83467a846185c4a473337d02 (patch)
tree3efc3876cac03e72def19182b9fcdb1e0ae7cbf1
parent9b3cb8e5ff9ac571f91a5bca486988992665c5c9 (diff)
Duda/Colucci: downloading medium mail set on request
-rw-r--r--.gitignore1
-rw-r--r--fake-service/Gemfile1
-rw-r--r--fake-service/Gemfile.lock2
-rw-r--r--fake-service/lib/pixelated_service/fake.rb21
4 files changed, 23 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index d226c608..207be4cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,5 +22,6 @@ public/
screenshot*
*.pyc
env/
+fake-service/data/mail-sets/
.vagrant/
__pycache__/
diff --git a/fake-service/Gemfile b/fake-service/Gemfile
index 5b3eccda..302269a7 100644
--- a/fake-service/Gemfile
+++ b/fake-service/Gemfile
@@ -10,6 +10,7 @@ gem "shotgun"
gem "rakeup"
gem "rspec"
gem "mail"
+gem "archive-tar-minitar"
gem "capybara"
gem "selenium-webdriver"
diff --git a/fake-service/Gemfile.lock b/fake-service/Gemfile.lock
index a5462ffb..15e7b1fc 100644
--- a/fake-service/Gemfile.lock
+++ b/fake-service/Gemfile.lock
@@ -2,6 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
addressable (2.3.6)
+ archive-tar-minitar (0.5.2)
backports (3.6.0)
builder (3.2.2)
capybara (2.3.0)
@@ -102,6 +103,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ archive-tar-minitar
capybara
capybara-screenshot
cucumber
diff --git a/fake-service/lib/pixelated_service/fake.rb b/fake-service/lib/pixelated_service/fake.rb
index 48709096..bc623fa8 100644
--- a/fake-service/lib/pixelated_service/fake.rb
+++ b/fake-service/lib/pixelated_service/fake.rb
@@ -1,3 +1,7 @@
+require 'open-uri'
+require 'archive/tar/minitar'
+require 'fileutils'
+
module PixelatedService
class << self
def mail_service
@@ -7,8 +11,8 @@ module PixelatedService
module Fake
PERSONAS = [
- Persona.new(1, "Yago Macedo", nil, "sirineu@souza.org")
- ]
+ Persona.new(1, "Yago Macedo", nil, "sirineu@souza.org")
+ ]
def personas
PERSONAS.map(&:ident)
@@ -115,6 +119,19 @@ module PixelatedService
end
def control_mailset_load(name)
+ mbox_root = 'data/mail-sets/'
+ if (Dir["#{mbox_root}/mbox*"].empty?)
+
+ FileUtils.mkdir_p(mbox_root)
+ unless (File.exists?("#{mbox_root}/mediumtagged.tar.gz"))
+ medium_tagged = File.new("#{mbox_root}/mediumtagged.tar.gz", 'w')
+ web_medium_tagged = open('https://example.wazokazi.is:8154/go/static/mediumtagged.tar.gz', :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
+ medium_tagged.write(web_medium_tagged.read)
+ medium_tagged.close
+ end
+ Archive::Tar::Minitar.unpack("#{mbox_root}/mediumtagged.tar.gz", mbox_root)
+ end
+
with_timing do
{
stats: PixelatedService.mail_service.load_mailset(name),