<commit_before>require File.dirname(__FILE__) + '/../minitest_helper.rb'
require 'montage/client'

class Montage::ClientTest < Minitest::Test
  context "initialization" do
    should "accept a username" do
      client = Montage::Client.new do |config|
        config.username = "<EMAIL>"
        config.domain= "test"
      end

      assert_equal "<EMAIL>", client.username
    end

    should "raise exception if no domain is passed" do
      assert_raises(Montage::Client::MissingAttributeError, "You must declare the domain attribute") do
        client = Montage::Client.new do |config|
          config.username = "<EMAIL>"
        end
      end
    end

    should "set the api version to 1 by default" do
      client = Montage::Client.new do |config|
        config.username = "<EMAIL>"
        config.domain = "test"
      end
      assert_equal 1, client.api_version
    end

    should "accept a password" do
      client = Montage::Client.new do |config|
        config.password = "<PASSWORD>"
        config.domain= "test"
      end

      assert_equal "foo", client.password
    end

    should "accept a domain name" do
      client = Montage::Client.new do |config|
        config.domain = "mydomain"
      end

      assert_equal "mydomain", client.domain
    end

    should "accept a token" do
      client = Montage::Client.new do |config|
        config.token = "aaaa"
        config.domain= "test"
      end

      assert_equal "aaaa", client.token
    end
  end
end<commit_msg>added test for changing api version<commit_after>require File.dirname(__FILE__) + '/../minitest_helper.rb'
require 'montage/client'

class Montage::ClientTest < Minitest::Test
  context "initialization" do
    should "accept a username" do
      client = Montage::Client.new do |config|
        config.username = "<EMAIL>"
        config.domain= "test"
      end

      assert_equal "<EMAIL>", client.username
    end

    should "raise exception if no domain is passed" do
      assert_raises(Montage::Client::MissingAttributeError, "You must declare the domain attribute") do
        client = Montage::Client.new do |config|
          config.username = "<EMAIL>"
        end
      end
    end

    should "set the api version to 1 by default" do
      client = Montage::Client.new do |config|
        config.username = "<EMAIL>"
        config.domain = "test"
      end
      assert_equal 1, client.api_version
    end
    should "overwrite the api version" do
      client = Montage::Client.new do |config|
        config.username = "<EMAIL>"
        config.domain = "test"
        config.api_version = 2
      end
      assert_equal 2, client.api_version
    end

    should "accept a password" do
      client = Montage::Client.new do |config|
        config.password = "<PASSWORD>"
        config.domain= "test"
      end

      assert_equal "foo", client.password
    end

    should "accept a domain name" do
      client = Montage::Client.new do |config|
        config.domain = "mydomain"
      end

      assert_equal "mydomain", client.domain
    end

    should "accept a token" do
      client = Montage::Client.new do |config|
        config.token = "aaaa"
        config.domain= "test"
      end

      assert_equal "aaaa", client.token
    end
  end
end
{'fraction_non_alphanumeric': 0.097799511002445, 'fraction_numerical': 0.0018337408312958435, 'mean_word_length': 2.409375, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 14, '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': '7220246', 'n_tokens_mistral': 953, 'n_tokens_neox': 928, 'n_words': 291}