Sha256: 2deecd12d1623d9cb41823f43d1162bd30362d9e8ccfa3351d12ef03bc56ff8c

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# -*- coding: utf-8 -*-
require File.dirname(__FILE__) + '/test_helper.rb'

class TestGyazz < Test::Unit::TestCase
  def test_text
    g = Gyazz.new('test')
    g.set('test','bbbbb')
    assert_equal(g.get('test'),"bbbbb")
    
    val = ["abc", "def"]
    g.settext('test',val)
    assert_equal(g.text('test'),"abc\ndef")
    
    val = ["abc\ndef"]
    g.settext('test',val)
    assert_equal(g.text('test'),"abc\ndef")
    
    list = g.list
    assert_equal(list.class,Array)
    assert(list.length > 0)
  end
  
  def test_auth
    #
    # http://Gyazz.com/test_auth/
    #  user: test_username
    #  pass: test_password
    #
    g = Gyazz.new('test_auth','test_username','test_password')
    g.set('test','abcdefg')
    assert_equal(g.get('test'),'abcdefg')
    g.set('test','99999')
    assert_equal(g.get('test'),'99999')
  end

  def __test_exception
    # 通信失敗をエミュレーションするにはどうするのか?
    error = ''
    begin
      g = Gyazz.new('testxxxx')
      s = g.get('nonexistent page')
    rescue => e
      error = e.to_s
    end
    assert(error != '')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gyazz-0.0.3 test/test_gyazz.rb