Sha256: 40ded7eab8fb2fd8613ac2d258bd7a16230491cbc6adeaa60e09b592190dd4f6

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require "minitest/autorun"
require "minitest/unit"

require_relative '../lib/aspose_ocr_cloud'

class OCRTests < Minitest::Test
	include MiniTest::Assertions
	include AsposeOCRCloud
	include AsposeStorageCloud
	
	def setup
        #Get App key and App SID from https://cloud.aspose.com
        AsposeApp.app_key_and_sid("", "")
		@ocr_api = OcrApi.new
	end

	def teardown
	end

	def upload_file(file_name)
        @storage_api = StorageApi.new
		response = @storage_api.put_create(file_name, File.open("data/" << file_name,"r") { |io| io.read } )
		assert(response, message="Failed to upload {file_name} file.")
	end

	def test_post_ocr_from_url_or_content
		opts = {url: "http://s017.radikal.ru/i406/1202/7b/70183bef7a09.jpg", use_default_dictionaries: true}
        
        response = @ocr_api.post_ocr_from_url_or_content(opts)
	 	assert(response, message="Failed to recognize image text from some url if provided or from the request body content.")
	end
    
    def test_get_recognize_document
    	file_name = "Sampleocr.bmp"
    	upload_file(file_name)

    	response = @ocr_api.get_recognize_document(file_name)
    	assert(response, message="Failed to recognize image text.")
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aspose_ocr_cloud-1.0.0 test/ocr_tests.rb