control 'python36' do
  # Get node attributes
  nodes_dir = '/tmp/kitchen/nodes'
  output = command("ls #{nodes_dir}").stdout.strip
  node_json = "#{nodes_dir}/#{output}"
  node = json(node_json).params

  case node['automatic']['platform_family']
  when 'rhel'
    if node['automatic']['platform_version'].to_s.start_with?('7')
      describe command('yum repolist') do
        its('stdout') { should include 'IUS' }
        its('stdout') { should include 'IUS-source' }
      end

      # Removed packages
      removed_packages = %w(
        python36u
        python36u-libs
        python36u-devel
        python36u-pip
      )

      removed_packages.each do |package|
        describe package(package) do
          it { should_not be_installed }
        end
      end

      describe command('which python3.6') do
        its('stdout') { should include 'python3.6' }
        its('exit_status') { should eq 0 }
      end
    end
  end
end
