<commit_before>#mixin to automate testing of Rest services per controller test

require 'libxml'
require 'pp'

module RestTestCases
    
  
  SCHEMA_FILE_PATH = File.join(RAILS_ROOT, 'public', '2010', 'xml', 'rest', 'schema-v1.xsd')
  
  def test_index_xml
    get :index, :format=>"xml"
    assert_response :success
    
    valid,message = check_xml
    assert valid,message
    validate_xml_against_schema(@response.body)
  end
  
  def test_get_xml
    get :show,:id=>@object, :format=>"xml"    
    assert_response :success    
    valid,message = check_xml
    assert valid,message        
    validate_xml_against_schema(@response.body)<commit_msg>quick check that rest api tests are being run<commit_after>#mixin to automate testing of Rest services per controller test

require 'libxml'
require 'pp'

module RestTestCases
    
  
  SCHEMA_FILE_PATH = File.join(RAILS_ROOT, 'public', '2010', 'xml', 'rest', 'schema-v1.xsd')
  
  def test_index_xml
    get :index, :format=>"xml"
    assert_response :success
    
    valid,message = check_xml
    assert !valid,message
    validate_xml_against_schema(@response.body)
  end
  
  def test_get_xml
    get :show,:id=>@object, :format=>"xml"    
    assert_response :success    
    valid,message = check_xml
    assert valid,message        
    validate_xml_against_schema(@response.body)
{'fraction_non_alphanumeric': 0.0960536113179449, 'fraction_numerical': 0.007446016381236039, 'mean_word_length': 3.6505190311418687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, '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': '2064531', 'n_tokens_mistral': 450, 'n_tokens_neox': 436, 'n_words': 103}