<commit_before>require 'helper'

class TestCloudAppAPI < Test::Unit::TestCase

  should "be able to create a client" do    
    flunk "Couldn't create client." if client.nil?
  end

  should "test retreiving a listing of my uploaded files." do
    items = client.items
    unless items.class == ::Array
      flunk "Couldn't retrieve the items."
    end
  end
  
  should "test creating a bookmark" do
    unless client.bookmark("CloudApp","http://cloudapp.com").class == ::CloudApp::Item
      flunk "Failed to create a bookmark."
    end
  end
  
  should "be able to delete an item" do
    res = client.delete "rAnD"
    flunk "Couldn't delete an item" unless res === true
    
    res = client.delete "rAnD"
    flunk "Shouldn't be able to delete the same item" if !res.respond_to?(:code) && res.code != 404
  end
  
  should "be able to upload a file" do
    begin
      res = client.upload 'README.md'
      flunk "Couldn't upload the file" unless res.class == ::CloudApp::Item
    end
  end

  ### Can't think of any other test to add at the moment

end<commit_msg>removed flunk calls in favor of assertions.<commit_after>require 'helper'

class TestCloudAppAPI < Test::Unit::TestCase

  should "be able to create a client" do
    assert_instance_of CloudApp::Client, client, "Couldn't create client."
  end

  should "test retreiving a listing of my uploaded files." do
    items = client.items
    assert_instance_of Array, items, "Couldn't retrieve the items."
  end
  
  should "test creating a bookmark" do
    b = client.bookmark("CloudApp","http://cloudapp.com")
    assert_instance_of CloudApp::Item, b, "Failed to create a bookmark."
  end
  
  should "be able to delete an item" do
    res = client.delete "rAnD"
    assert_same true, res, "Couldn't delete an item"
    
    bad_res = client.delete "rAnD"
    message = "Shouldn't be able to delete the same item"
    assert_not_same true, bad_res, message
    assert bad_res.class == HTTParty::Response, message
    # the above test passed, but the following wouldn't
    # assert_instance_of HTTParty::Response, bad_res
    # kept saying bad_res was nil.  Could this be a bug?
  end
  
  should "be able to upload a file" do
    res = client.upload 'README.md'
    assert_instance_of CloudApp::Item, res, "Couldn't upload the file"
  end

  ### Can't think of any other test to add at the moment

end
{'fraction_non_alphanumeric': 0.09117771211481637, 'fraction_numerical': 0.001266357112705783, 'mean_word_length': 3.202127659574468, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2456210', 'n_tokens_mistral': 753, 'n_tokens_neox': 728, 'n_words': 282}