Sha256: e7c7bfae63f79de46f603b47d7cd17bc12f69eb7832536a2b4e31bd7e525d84b

Contents?: true

Size: 1.71 KB

Versions: 2

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

include StixRuby::Aliases

describe Java::OrgMitreStixCore::STIXType do
  context "instance" do
    before do
      @stix = STIXPackage.new
    end

    it "should have a default version" do
      @stix.version.should == "1.0.1"
    end

    it "should allow adding observables" do
      @stix.add_observable(Observable.new)
      @stix.observables.observables.length.should == 1
    end

    it "should allow adding campaigns" do
      @stix.add_campaign(Campaign.new)
      @stix.campaigns.campaigns.length.should == 1
    end

    it "should allow adding courses of action" do
      @stix.add_course_of_action(CourseOfAction.new)
      @stix.courses_of_action.course_of_actions.length.should == 1
    end

    it "should allow adding exploit targets" do
      @stix.add_exploit_target(ExploitTarget.new)
      @stix.exploit_targets.exploit_targets.length.should == 1
    end

    it "should allow adding incidents" do
      @stix.add_incident(Incident.new)
      @stix.incidents.incidents.length.should == 1
    end

    it "should allow adding indicators" do
      @stix.add_indicator(Indicator.new)
      @stix.indicators.indicators.length.should == 1
    end

    it "should allow adding threat actors" do
      @stix.add_threat_actor(ThreatActor.new)
      @stix.threat_actors.threat_actors.length.should == 1
    end

    it "should allow adding TTPs" do
      @stix.add_ttp(TTP.new)
      @stix.ttps.ttps.length.should == 1
    end
  end

  context "class" do

    it "should read files from XML" do
      stix = org.mitre.stix.core.STIXType.from_xml(File.read('spec/test_data/fireeye-pivy-report.xml'))

      stix.stix_header.title.should == "Poison Ivy: Assessing Damage and Extracting Intelligence"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_stix-0.2.0-java spec/units/stix_type_spec.rb
ruby_stix-0.0.2-java spec/units/stix_type_spec.rb