<commit_before>################################################################################
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

require 'spec_helper'

provider_class = Puppet::Type.type(:oneview_storage_system).provider(:ruby)

describe provider_class do


  # Negative testing all the get/find operations
  # context 'given the minimum parameters' do
  #   let(:resource) {
  #     Puppet::Type.type(:oneview_storage_system).new(
  #       name: 'Enclosure',
  #       ensure: 'present',
  #         data:
  #           {
  #             'credentials'   => {
  #               'ip_hostname' => '172.18.11.11',
  #             }
  #           },
  #     )
  #   }



  # end

  context 'given the parameters for creating a storage' do
    let(:resource) {
      Puppet::Type.type(:oneview_storage_system).new(
        name: 'Storage System',
        ensure: 'present',
        data:
          {
            'name'          => 'Puppet_Test_Storage_System',
            'managedDomain' => 'TestDomain',
            'credentials'   => {
              'ip_hostname' => '172.18.11.11',
              'username'    => 'dcs',
              'password'    => '<PASSWORD>'
            }
          }
      )
    }

    let(:provider) { resource.provider }

    let(:instance) { provider.class.instances.first }

    it 'should be an instance of the provider Ruby' do
      expect(provider).to be_an_instance_of Puppet::Type.type(:oneview_storage_system).provider(:ruby)
    end

    it 'exists? should not find the storage system' do
      expect(provider.exists?).not_to be
    end

    it 'should return that the storage system was not found' do
      expect(provider.found).not_to be
    end

    it 'should not be able to get the storage pools from the storage system' do
      expect(provider.get_storage_pools).not_to be
    end

    it 'should not be able to get the managed ports from the storage system' do
      expect(provider.get_managed_ports).not_to be
    end

    it 'should not be able to get the host types from the storage system' do
      expect(provider.get_host_types).not_to be
    end

    it 'should create the storage system' do
      expect(provider.create).to be
    end

    it 'exists? should find the storage system' do
      expect(provider.exists?).to be
    end

    # TODO fix these
    # it 'should return that the storage system was found' do
    #   expect(provider.found).to be
    # end
    #
    # it 'should be able to get the storage pools from the storage system' do
    #   expect(provider.get_storage_pools).to be
    # end
    #
    # it 'should be able to get the managed ports from the storage system' do
    #   expect(provider.get_managed_ports).to be
    # end
    #
    # it 'should be able to get the host types from the storage system' do
    #   expect(provider.get_host_types).to be
    # end

    it 'should drop the storage system' do
      expect(provider.destroy).to be
    end



  end

end<commit_msg>Fixed the spec provider test, final commit before PR<commit_after>################################################################################
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

require 'spec_helper'

provider_class = Puppet::Type.type(:oneview_storage_system).provider(:ruby)

describe provider_class do

  let(:resource) {
    Puppet::Type.type(:oneview_storage_system).new(
      name: 'Enclosure',
      ensure: 'present',
        data:
          {
            'credentials'   => {
              'ip_hostname' => '172.18.11.11',
            }
          },
    )
  }

  let(:provider) { resource.provider }

  let(:instance) { provider.class.instances.first }

  context 'given the minimum parameters' do
    # Negative testing all the get/find operations
    #   let(:resource) {
    #     Puppet::Type.type(:oneview_storage_system).new(
    #       name: 'Enclosure',
    #       ensure: 'present',
    #         data:
    #           {
    #             'credentials'   => {
    #               'ip_hostname' => '172.18.11.11',
    #             }
    #           },
    #     )
    #   }
    #
    # let(:provider) { resource.provider }
    #
    # let(:instance) { provider.class.instances.first }

    it 'should be an instance of the provider Ruby' do
      expect(provider).to be_an_instance_of Puppet::Type.type(:oneview_storage_system).provider(:ruby)
    end

    it 'exists? should not find the storage system' do
      expect(provider.exists?).not_to be
    end

    it 'should return that the storage system was not found' do
      expect(provider.found).not_to be
    end

    it 'should not be able to get the storage pools from the storage system' do
      expect(provider.get_storage_pools).not_to be
    end

    it 'should not be able to get the managed ports from the storage system' do
      expect(provider.get_managed_ports).not_to be
    end

    it 'should not be able to get the host types from the storage system' do
      expect(provider.get_host_types).not_to be
    end

  end

  context 'given the create parameters' do
    let(:resource) {
      Puppet::Type.type(:oneview_storage_system).new(
        name: 'Enclosure',
        ensure: 'present',
          data:
            {
              'name'         => 'OneViewSDK Test Storage System',
              'managedDomain' => 'TestDomain',
              'credentials'   => {
                'ip_hostname' => '172.18.11.11',
                'username'     => 'dcs',
                'password'     => '<PASSWORD>',
              }
            },
      )
    }

    # TODO Create block
    it 'should create the storage system' do
      expect(provider.create).to be
    end

  end

  context 'given the minimum parameters' do
    it 'exists? should find the storage system' do
      expect(provider.exists?).to be
    end
    it 'should return that the storage system was found' do
      expect(provider.found).to be
    end

    it 'should be able to get the storage pools from the storage system' do
      expect(provider.get_storage_pools).to be
    end

    it 'should be able to get the managed ports from the storage system' do
      expect(provider.get_managed_ports).to be
    end

    it 'should be able to get the host types from the storage system' do
      expect(provider.get_host_types).to be
    end

    it 'should drop the storage system' do
      expect(provider.destroy).to be
    end
    
  end

end
{'fraction_non_alphanumeric': 0.12832550860719874, 'fraction_numerical': 0.007955138236828377, 'mean_word_length': 2.5178899082568806, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6980515', 'n_tokens_mistral': 2183, 'n_tokens_neox': 2080, 'n_words': 713}