require 'spec_helper'

describe file('/etc/cumulus/.license.txt') do
  it { should be_file }
end

describe command('/usr/cumulus/bin/cl-license') do
  its(:stdout) { should match(/email=/) }
  its(:stdout) { should match(/account=/) }
  its(:stdout) { should match(/expires=/) }
  its(:stdout) { should match(/serial=/) }
  its(:stdout) { should match(/num_licenses=/) }
  its(:stdout) { should match(/need_eula=0/) }
  its(:stdout) { should match(/BEGIN PGP SIGNED MESSAGE/) }
  its(:stdout) { should match(/BEGIN PGP SIGNATURE/) }
  its(:stdout) { should match(/END PGP SIGNATURE/) }
end

require 'spec_helper'

if file('/etc/cumulus/.license.txt').exists?
  describe file('/etc/cumulus/.license.txt') do
    it { should be_file }
  end

  describe command('/usr/cumulus/bin/cl-license') do
    its(:stdout) { should match(/email=/) }
    its(:stdout) { should match(/account=/) }
    its(:stdout) { should match(/expires=/) }
    its(:stdout) { should match(/serial=/) }
    its(:stdout) { should match(/num_licenses=/) }
    its(:stdout) { should match(/need_eula=0/) }
    its(:stdout) { should match(/BEGIN PGP SIGNED MESSAGE/) }
    its(:stdout) { should match(/BEGIN PGP SIGNATURE/) }
    its(:stdout) { should match(/END PGP SIGNATURE/) }
  end
else
  describe file('/etc/cumulus/.license') do
    it { should be_file }
  end
end

Make the license tests work for both v1 & v2
Make the license tests work for both v1 & v2

Check if a V1 license file exists and perform a slightly different set of tests
if it does; the filename is different between V1 & V2 and there aren't many
useful tests we can apply to a V2 license.
