<commit_before>require 'test/unit'
require "orientdb4r"

###
# This class tests following operations:
# * CONNECT
# * DISCONNECT
# * CREATE DATABASE
class TestRest < Test::Unit::TestCase

  def setup
    @client = Orientdb4r.client
  end

  ###
  # CONNECT.
  def test_connect
    rslt = @client.connect :database => 'temp', :user => 'admin', :password => '<PASSWORD>'
    assert_instance_of Hash, rslt
    assert rslt.size > 0
    assert rslt.include? 'classes'

    # bad DB name
    assert_raise Orientdb4r::OrientdbError do
      @client.connect :database => 'unknown_db', :user => 'admin', :password => '<PASSWORD>'
    end
    # bad credentials
    assert_raise Orientdb4r::OrientdbError do
      @client.connect :database => 'temp', :user => 'admin1', :password => '<PASSWORD>'
    end
  end


  ###
  # DISCONNECT.
  def test_disconnect
    @client.disconnect
    assert !@client.connected?
    # unable to query after disconnect
    assert_raise Orientdb4r::OrientdbError do @client.query 'SELECT FROM OUser'; end
  end


  ###
  # CREATE DATABASE.
  # Temporary disabled bacause of unknown way haw to drop a new created datatabse.
  def xtest_create_database
    @client.create_database :database => 'UniT', :user => 'root', :password => '<PASSWORD>'
    # creating an existing DB
    assert_raise Orientdb4r::OrientdbError do
      @client.create_database :database => 'UniT', :user => 'root', :password => '<PASSWORD>'
    end
    # insufficient rights
    assert_raise Orientdb4r::OrientdbError do
      @client.create_database :database => 'UniT1', :user => 'admin', :password => '<PASSWORD>'
    end

    # By convention 3 users are always created by default every time you create a new database.
    # Default users are: admin, reader, writer
    @client.connect :database => 'UniT', :user => 'admin', :password => '<PASSWORD>'
    #@client.command "DROP DATABASE UniT" : NOT WORKING now
  end

end<commit_msg>typo in docu<commit_after>require 'test/unit'
require "orientdb4r"

###
# This class tests following operations:
# * CONNECT
# * DISCONNECT
# * CREATE DATABASE
class TestRest < Test::Unit::TestCase

  def setup
    @client = Orientdb4r.client
  end

  ###
  # CONNECT.
  def test_connect
    rslt = @client.connect :database => 'temp', :user => 'admin', :password => '<PASSWORD>'
    assert_instance_of Hash, rslt
    assert rslt.size > 0
    assert rslt.include? 'classes'

    # bad DB name
    assert_raise Orientdb4r::OrientdbError do
      @client.connect :database => 'unknown_db', :user => 'admin', :password => '<PASSWORD>'
    end
    # bad credentials
    assert_raise Orientdb4r::OrientdbError do
      @client.connect :database => 'temp', :user => 'admin1', :password => '<PASSWORD>'
    end
  end


  ###
  # DISCONNECT.
  def test_disconnect
    @client.disconnect
    assert !@client.connected?
    # unable to query after disconnect
    assert_raise Orientdb4r::OrientdbError do @client.query 'SELECT FROM OUser'; end
  end


  ###
  # CREATE DATABASE.
  # Temporary disabled bacause of unknown way how to drop a new created datatabse.
  def xtest_create_database
    @client.create_database :database => 'UniT', :user => 'root', :password => '<PASSWORD>'
    # creating an existing DB
    assert_raise Orientdb4r::OrientdbError do
      @client.create_database :database => 'UniT', :user => 'root', :password => '<PASSWORD>'
    end
    # insufficient rights
    assert_raise Orientdb4r::OrientdbError do
      @client.create_database :database => 'UniT1', :user => 'admin', :password => '<PASSWORD>'
    end

    # By convention 3 users are always created by default every time you create a new database.
    # Default users are: admin, reader, writer
    @client.connect :database => 'UniT', :user => 'admin', :password => '<PASSWORD>'
    #@client.command "DROP DATABASE UniT" : NOT WORKING now
  end

end
{'fraction_non_alphanumeric': 0.12308491300960789, 'fraction_numerical': 0.005712801869644248, 'mean_word_length': 3.6353790613718413, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6481677', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1196, 'n_words': 359}