Sha256: d8146267d16b9922ab72115cbb9f7574c012db83ef9aca757c72ec561baa0b6f

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

require 'test_xml_extractor_helper'

class TestXMLExtractorExternalOrganisation < Minitest::Test

  def xml_extractor_from_id(id)
    client = Puree::REST::Client.new config
    response = client.external_organisations.find id: id
    Puree::XMLExtractor::ExternalOrganisation.new response.to_s
  end

  def test_initialize
    xml = '<foo/>'
    xml_extractor = Puree::XMLExtractor::ExternalOrganisation.new xml

    assert_instance_of Puree::XMLExtractor::ExternalOrganisation, xml_extractor
  end

  def test_core
    # STFC
    id = '2ea6bbc4-c957-4a07-a1e7-604a2d944c20'
    x = xml_extractor_from_id id

    asserts_resource x

    assert_instance_of String, x.name
    refute_empty x.name

    assert_instance_of String, x.type
    refute_empty x.type
  end

  def test_absence
    xml = '<foo/>'
    x = Puree::XMLExtractor::ExternalOrganisation.new xml

    assert_nil x.name

    assert_nil x.type
  end

  def test_model
    # STFC
    id = '2ea6bbc4-c957-4a07-a1e7-604a2d944c20'
    x = xml_extractor_from_id id

    assert_instance_of Puree::Model::ExternalOrganisation, x.model
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
puree-2.5.0 test/xml_extractor/xml_extractor_external_organisation_test.rb
puree-2.4.0 test/xml_extractor/xml_extractor_external_organisation_test.rb
puree-2.3.0 test/xml_extractor/xml_extractor_external_organisation_test.rb
puree-2.2.0 test/xml_extractor/xml_extractor_external_organisation_test.rb
puree-2.1.1 test/xml_extractor/xml_extractor_external_organisation_test.rb
puree-2.1.0 test/xml_extractor/xml_extractor_external_organisation_test.rb
puree-2.0.0 test/xml_extractor/xml_extractor_external_organisation_test.rb