<commit_before># encoding: utf-8

require 'spec_helper'

module NessusDB
	module Models		
		describe Item do
			before(:all) do
				@high = Item.make(:severity => 3)
				@med = Item.make(:severity => 2)
				@low = Item.make(:severity => 1)
				@info = Item.make(:severity => 0)
					
				printf "%s\n%s\n%s\n%s\n\n", @high.inspect, @med.inspect, @low.inspect, @info.inspect
							
			end
			
			it "should include high, medium, low and info risks for Item.risks.all" do				
				Item.risks.all.should include(@high, @med, @low, @info)
			end
			
			it "returns 4 risks for Item.risks.count" do
				Item.risks.count.should == 4
			end

			it "returns 1 risks for Item.high_risks.count" do
				Item.high_risks.all.count.should == 1
			end

			it "returns 1 for Item.medium_risks.count" do
				Item.medium_risks.all.count.should == 1
			end

			it "returns 1 for Item.low_risks.count" do
				Item.low_risks.all.count.should == 1
			end
			
			it "returns 1 risks for Item.info_risks.count" do
				Item.info_risks.all.count.should == 1
			end			

			it "returns 4 risks for Item.risks_by_service" do
				Item.risks_by_service(100000).all.count.should == 4
			end

			it "returns 2 risks for Item.risks_by_host" do
				Item.risks_by_host(100000).all.count.should == 2
			end

			it "returns 1 risks for Item.risks_by_plugin" do
				Item.risks_by_plugin(100000).all.count.should == 1
			end

			it "returns 1 for Item.high_risks_unique.count" do
				Item.high_risks_unique.all.count.should == 1
			end
			
			it "returns 1 for Item.high_risks_unique_sorted.count" do
				Item.high_risks_unique_sorted.all.count.should == 1
			end

			it "returns 1 for Item.medium_risks_unique.count" do
				Item.medium_risks_unique.all.count.should == 1
			end
			
			it "returns 1 for Item.medium_risks_unique_sorted.count" do
				Item.medium_risks_unique_sorted.all.count.should == 1
			end

			it "returns 1 for Item.low_risks_unique.count" do
				Item.low_risks_unique.all.count.should == 1
			end
			
			it "returns 1 for Item.low_risks_unique_sorted.count" do
				Item.low_risks_unique_sorted.all.count.should == 1
			end
			
			it "returns 1 for Item.info_risks_unique_sorted.count" do
				Item.info_risks_unique_sorted.all.count.should == 1
			end
			
			it "returns 1 for Item.info_risks_unique.count" do
				Item.info_risks_unique.all.count.should == 1
			end
	
			it "returns a graph Item.risks_by_severity_graph" do
				Item.risks_by_severity_graph.class.should == StringIO
			end
			
			it "returns a graph Item.risks_by_service_graph" do
				Item.risks_by_service_graph.should be_a_kind_of StringIO
			end
			
			it "returns 0 for Item.ms_update" do
				Item.ms_update.all.count.should == 0
			end
			
			it "returns 0 for Item.ms_patches" do
				Item.ms_patches.all.count.should == 0
			end						
		end<commit_msg>Fixed spacing and tabs<commit_after># encoding: utf-8
 	
require 'spec_helper'

module NessusDB
	module Models
		describe Item do
			before(:all) do
				@high = Item.make(:severity => 3)
				@med = Item.make(:severity => 2)
				@low = Item.make(:severity => 1)
				@info = Item.make(:severity => 0)

				printf "%s\n%s\n%s\n%s\n\n", @high.inspect, @med.inspect, @low.inspect, @info.inspect

			end

			it "should include high, medium, low and info risks for Item.risks.all" do
				Item.risks.all.should include(@high, @med, @low, @info)
			end

			it "returns 4 risks for Item.risks.count" do
				Item.risks.count.should == 4
			end

			it "returns 1 risks for Item.high_risks.count" do
				Item.high_risks.all.count.should == 1
			end

			it "returns 1 for Item.medium_risks.count" do
				Item.medium_risks.all.count.should == 1
			end

			it "returns 1 for Item.low_risks.count" do
				Item.low_risks.all.count.should == 1
			end

			it "returns 1 risks for Item.info_risks.count" do
				Item.info_risks.all.count.should == 1
			end

			it "returns 4 risks for Item.risks_by_service" do
				Item.risks_by_service(100000).all.count.should == 4
			end

			it "returns 2 risks for Item.risks_by_host" do
				Item.risks_by_host(100000).all.count.should == 2
			end

			it "returns 1 risks for Item.risks_by_plugin" do
				Item.risks_by_plugin(100000).all.count.should == 1
			end

			it "returns 1 for Item.high_risks_unique.count" do
				Item.high_risks_unique.all.count.should == 1
			end

			it "returns 1 for Item.high_risks_unique_sorted.count" do
				Item.high_risks_unique_sorted.all.count.should == 1
			end

			it "returns 1 for Item.medium_risks_unique.count" do
				Item.medium_risks_unique.all.count.should == 1
			end

			it "returns 1 for Item.medium_risks_unique_sorted.count" do
				Item.medium_risks_unique_sorted.all.count.should == 1
			end

			it "returns 1 for Item.low_risks_unique.count" do
				Item.low_risks_unique.all.count.should == 1
			end

			it "returns 1 for Item.low_risks_unique_sorted.count" do
				Item.low_risks_unique_sorted.all.count.should == 1
			end

			it "returns 1 for Item.info_risks_unique_sorted.count" do
				Item.info_risks_unique_sorted.all.count.should == 1
			end

			it "returns 1 for Item.info_risks_unique.count" do
				Item.info_risks_unique.all.count.should == 1
			end

			it "returns a graph Item.risks_by_severity_graph" do
				Item.risks_by_severity_graph.class.should == StringIO
			end

			it "returns a graph Item.risks_by_service_graph" do
				Item.risks_by_service_graph.should be_a_kind_of StringIO
			end

			it "returns 0 for Item.ms_update" do
				Item.ms_update.all.count.should == 0
			end

			it "returns 0 for Item.ms_patches" do
				Item.ms_patches.all.count.should == 0
			end
		end
{'fraction_non_alphanumeric': 0.099568655643422, 'fraction_numerical': 0.021207764198418404, 'mean_word_length': 3.0180505415162453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1601938', 'n_tokens_mistral': 2575, 'n_tokens_neox': 2020, 'n_words': 480}