Sha256: 746f595ef6235bdb61188cd72c09a93be0be141273ebd4736f08ffba15298961

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 KB

Contents

# -*- coding: utf-8 -*-
require 'helper'

class TestJSONPublish < Test::Unit::TestCase
  include Vortex

  def setup
    if(not(@vortex))
      user = ENV['DAVUSER']
      pass = ENV['DAVPASS']
      # puts "JSON testene kan foreløpig ikke kjøres på vortex.uio.no?"
      @vortex = Connection.new("https://nyweb1-dav.uio.no",user, pass)
    end
  end

  should "publish JSON articles" do
    # url = 'https://vortex-dav.uio.no/bloggimport/json-test.html'
    url = 'bloggimport/json-test.html'
    if(@vortex.exists?(url))
      @vortex.delete(url)
    end

    body = "<p>&nbsp;Bla bla<\/p>\r\n<p>Mer &quot;Bla&quot; bla<\/p>\r\n<p>"+
      "<strong>Enda<\/strong> <a href=\"http://www.vg.no\">mer<\/a> bla bla<\/p>\r\n<p>&nbsp;<\/p>"

    @vortex.cd('/bloggimport/')
    article = Vortex::StructuredArticle.new(:title => "JSON test",
                                            :introduction => "Sample introduction",
                                            :body => body, # .to_json, # "<p>Hello world</p><p>Bla bla</p>",
                                            :publishedDate => "05.01.2010 12:00",
                                            :author => "Thomas Flemming",
                                            :picture => "/bloggimport/forskning/arrangementer/disputaser/2008/01/gran_boe.jpg" )

    url = @vortex.publish(article)
    puts "For å fullføre testen: Se på denne siden i en nettleser: " + url
    assert @vortex.exists?(url)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vortex_client-0.7.3 test/test_json_publish.rb
vortex_client-0.7.2 test/test_json_publish.rb
vortex_client-0.7.0 test/test_json_publish.rb
vortex_client-0.6.0 test/test_json_publish.rb
vortex_client-0.5.9 test/test_json_publish.rb
vortex_client-0.5.8 test/test_json_publish.rb
vortex_client-0.5.6 test/test_json_publish.rb
vortex_client-0.5.5 test/test_json_publish.rb
vortex_client-0.5.4 test/test_json_publish.rb
vortex_client-0.5.3 test/test_json_publish.rb