<commit_before>require 'helper'

class TestExt < Test::Unit::TestCase

  context "The Fusion Tables helper functions" do
    setup do
      init_config
      @ft = GData::Client::FusionTables.new
      @ft.clientlogin(username, password)
    end


    should "raise ArgumentError if supply unknown types to it" do
      assert_raise ArgumentError do
        @ft.create_table "test table", [{:name => "test_col", :type => "billys birthday" }]
      end
    end

    should "let you create a table if you get everything right" do
      table = @ft.create_table "test_table", [{:name => "test_col", :type => "string" }]
      assert_equal GData::Client::FusionTables::Table, table.class
      @ft.drop(table.id)
    end

    should "correct your table name to a certain degree on create" do
      table = @ft.create_table "test table", [{:name => "test col", :type => "string" }]
      assert_equal "test_table", table.name
      @ft.drop(table.id)
    end

    should "return you a list of your fusion tables" do
      resp = @ft.show_tables
      assert_equal GData::Client::FusionTables::Table, resp.first.class if resp.first
    end

    should "be possible to delete a table with an id" do<commit_msg>Drop the table in teardown<commit_after>require 'helper'

class TestExt < Test::Unit::TestCase

  context "The Fusion Tables helper functions" do
    setup do
      init_config
      @ft = GData::Client::FusionTables.new
      @ft.clientlogin(username, password)
    end

    teardown do
      @ft.drop(@table.id) if @table and @table.id
    end

    should "raise ArgumentError if supply unknown types to it" do
      assert_raise ArgumentError do
        @ft.create_table "test table", [{:name => "test_col", :type => "billys birthday" }]
      end
    end

    should "let you create a table if you get everything right" do
      @table = @ft.create_table "test_table", [{:name => "test_col", :type => "string" }]
      assert_equal GData::Client::FusionTables::Table, @table.class
    end

    should "correct your table name to a certain degree on create" do
      @table = @ft.create_table "test table", [{:name => "test col", :type => "string" }]
      assert_equal "test_table", @table.name
    end

    should "return you a list of your fusion tables" do
      resp = @ft.show_tables
      assert_equal GData::Client::FusionTables::Table, resp.first.class if resp.first
    end

    should "be possible to delete a table with an id" do
{'fraction_non_alphanumeric': 0.10829587249693502, 'fraction_numerical': 0.0, 'mean_word_length': 3.135135135135135, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '1152827', 'n_tokens_mistral': 745, 'n_tokens_neox': 726, 'n_words': 253}