[Git][noosfero/noosfero][master] 2 commits: Html5VideoPlugin: fixes tests

Rodrigo Souto gitlab at mg.gitlab.com
Fri Nov 3 11:26:26 BRST 2017


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
ea2ae2d6 by Gabriel Silva at 2017-11-01T21:37:17-03:00
Html5VideoPlugin: fixes tests

Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>

- - - - -
75eda308 by Rodrigo Souto at 2017-11-03T13:26:12+00:00
Merge branch 'html5_video_tests' into 'master'

Html5VideoPlugin: fixes tests

See merge request noosfero/noosfero!1342
- - - - -


6 changed files:

- plugins/html5_video/features/video_player.feature
- plugins/html5_video/test/html5_video_plugin_test_helper.rb
- plugins/html5_video/test/integration/converter_test.rb
- plugins/html5_video/test/integration/video_processor_test.rb
- plugins/html5_video/test/unit/ffmpeg_test.rb
- plugins/html5_video/views/file_presenter/_video.html.erb


Changes:

=====================================
plugins/html5_video/features/video_player.feature
=====================================
--- a/plugins/html5_video/features/video_player.feature
+++ b/plugins/html5_video/features/video_player.feature
@@ -15,8 +15,8 @@ Feature: video player
 
   @selenium
   Scenario: controls must work
-    Given I am on /joaosilva/old-movie.mpg?view=true
+    Given I am on /joaosilva/old-movie?view=true
+    And I move the cursor over ".video-player .video-box"
+    And I click ".video-player .video-box .zoom"
     Then The page should contain only 2 ".video-player .quality li.ui-button"
-    #FIXME
-    #When I click ".video-player .video-box .zoom"
-    #Then the element ".video-player" has class "zoom-in"
+    And the element ".video-player" has class "zoom-in"


=====================================
plugins/html5_video/test/html5_video_plugin_test_helper.rb
=====================================
--- a/plugins/html5_video/test/html5_video_plugin_test_helper.rb
+++ b/plugins/html5_video/test/html5_video_plugin_test_helper.rb
@@ -11,7 +11,7 @@ module Html5VideoPluginTestHelper
   end
 
   def create_video(file, mime, profile=nil)
-    profile ||= fast_create(Person)
+    profile ||= create_user.person
     data = fixture_file_upload("/videos/#{file}", mime)
     UploadedFile.create!(uploaded_data: data, profile: profile)
   end


=====================================
plugins/html5_video/test/integration/converter_test.rb
=====================================
--- a/plugins/html5_video/test/integration/converter_test.rb
+++ b/plugins/html5_video/test/integration/converter_test.rb
@@ -10,7 +10,7 @@ class ConverterTest < ActiveSupport::TestCase
     Environment.default.enable_plugin Html5VideoPlugin
     @video = FilePresenter.for UploadedFile.create!(
       :uploaded_data => fixture_file_upload('/videos/firebus.3gp', 'video/3gp'),
-      :profile => fast_create(Person)
+      :profile => create_user.person
     )
 
     @ffmpeg = VideoProcessor::Ffmpeg.new
@@ -44,7 +44,7 @@ class ConverterTest < ActiveSupport::TestCase
   end
 
   should 'should not instantiate converter if file does not exist' do
-    assert_raise do
+    assert_raise IOError do
       VideoProcessor::Converter.new(@ffmpeg, 'nope', 404)
     end
   end
@@ -58,7 +58,7 @@ class ConverterTest < ActiveSupport::TestCase
   should 'create all web versions for a MPEG video' do
     video = FilePresenter.for UploadedFile.create!(
       :uploaded_data => fixture_file_upload('/videos/old-movie.mpg', 'video/mpeg'),
-      :profile => fast_create(Person)
+      :profile => create_user.person
     )
     converter = VideoProcessor::Converter.new(@ffmpeg, video.full_filename,
                                               video.id)
@@ -104,7 +104,8 @@ class ConverterTest < ActiveSupport::TestCase
 
     video = FilePresenter.for UploadedFile.create!(
       uploaded_data: Rack::Test::UploadedFile.new("#{@temp}/firebus.ogv", 'video/ogv'),
-      profile: fast_create(Person) )
+      profile: create_user.person
+    )
     converter = VideoProcessor::Converter.new(@ffmpeg, video.full_filename,
                                               video.id)
     converter.logger = @logger


=====================================
plugins/html5_video/test/integration/video_processor_test.rb
=====================================
--- a/plugins/html5_video/test/integration/video_processor_test.rb
+++ b/plugins/html5_video/test/integration/video_processor_test.rb
@@ -5,14 +5,15 @@ require_relative '../html5_video_plugin_test_helper'
 
 class VideoProcessorTest < ActiveSupport::TestCase
 
-  prepend Html5VideoPluginTestHelper
-
   # Disable transactional fixtures, so rails runner can see the same data
   self.use_transactional_fixtures = false
 
+  prepend Html5VideoPluginTestHelper
+
   def setup
+    UploadedFile.delete_all
     file = fixture_file_upload('/videos/atropelamento.ogv', 'video/ogv')
-    profile = fast_create(Person)
+    profile = create_user.person
     @video = UploadedFile.create!(uploaded_data: file, profile: profile)
     @presenter = FilePresenter.for @video
   end


=====================================
plugins/html5_video/test/unit/ffmpeg_test.rb
=====================================
--- a/plugins/html5_video/test/unit/ffmpeg_test.rb
+++ b/plugins/html5_video/test/unit/ffmpeg_test.rb
@@ -11,7 +11,7 @@ class FfmpegTest < ActiveSupport::TestCase
   def create_video(file, mime)
     file = UploadedFile.create!(
       :uploaded_data => fixture_file_upload('/videos/'+file, mime),
-      :profile => fast_create(Person))
+      :profile => create_user.person)
   end
 
   def video_path(file='')


=====================================
plugins/html5_video/views/file_presenter/_video.html.erb
=====================================
--- a/plugins/html5_video/views/file_presenter/_video.html.erb
+++ b/plugins/html5_video/views/file_presenter/_video.html.erb
@@ -2,13 +2,9 @@
 <div class="video-player">
   <% if video.has_web_version %>
     <%= render :partial => 'video_player', :locals => {:video => video} %>
-  <% elsif not video.conversion_jobs.empty? %>
-    <div class="message">
-      <%=_('Queued to generate the web version. Come back soon.')%>
-    </div>
   <% else %>
     <div class="message">
-      <%=_('This video is not queued to the video conversor. Contact the site admin.')%>
+      <%=_('Queued to generate the web version. Come back soon.')%>
     </div>
   <% end %>
   <div class="video-player-info">



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/4afacf6cc4da8d3045119af9ab89527903239b60...75eda308bac14f54650c672dfaf0eeb673e5e5a8

---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/4afacf6cc4da8d3045119af9ab89527903239b60...75eda308bac14f54650c672dfaf0eeb673e5e5a8
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20171103/fc8dc59b/attachment-0001.html>


More information about the Noosfero-dev mailing list