X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fneutron%2Fspec%2Funit%2Fprovider%2Fneutron_subnet%2Fneutron_spec.rb;fp=3rdparty%2Fmodules%2Fneutron%2Fspec%2Funit%2Fprovider%2Fneutron_subnet%2Fneutron_spec.rb;h=0000000000000000000000000000000000000000;hb=6e1426dc77fb4e5d51f07c187c6f2219431dc31e;hp=ed49cd6644ab56e795903a19578df0e0f5737963;hpb=87423ba664cd5f2bb462ebadd08b1a90d0fe1c8d;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/neutron/spec/unit/provider/neutron_subnet/neutron_spec.rb b/3rdparty/modules/neutron/spec/unit/provider/neutron_subnet/neutron_spec.rb deleted file mode 100644 index ed49cd664..000000000 --- a/3rdparty/modules/neutron/spec/unit/provider/neutron_subnet/neutron_spec.rb +++ /dev/null @@ -1,107 +0,0 @@ -require 'puppet' -require 'spec_helper' -require 'puppet/provider/neutron_subnet/neutron' - -provider_class = Puppet::Type.type(:neutron_subnet).provider(:neutron) - -describe provider_class do - - let :subnet_name do - 'net1' - end - - let :subnet_attrs do - { - :name => subnet_name, - :ensure => 'present', - :cidr => '10.0.0.0/24', - :ip_version => '4', - :gateway_ip => '10.0.0.1', - :enable_dhcp => 'False', - :network_name => 'net1', - :tenant_id => '', - :allocation_pools => 'start=7.0.0.1,end=7.0.0.10', - :dns_nameservers => '8.8.8.8', - :host_routes => 'destination=12.0.0.0/24,nexthop=10.0.0.1', - } - end - - describe 'when updating a subnet' do - let :resource do - Puppet::Type::Neutron_subnet.new(subnet_attrs) - end - - let :provider do - provider_class.new(resource) - end - - it 'should call subnet-update to change gateway_ip' do - provider.expects(:auth_neutron).with('subnet-update', - '--gateway-ip=10.0.0.2', - subnet_name) - provider.gateway_ip=('10.0.0.2') - end - - it 'should call subnet-update to remove gateway_ip with empty string' do - provider.expects(:auth_neutron).with('subnet-update', - '--no-gateway', - subnet_name) - provider.gateway_ip=('') - end - - it 'should call subnet-update to change enable_dhcp' do - provider.expects(:auth_neutron).with('subnet-update', - '--enable-dhcp', - subnet_name) - provider.enable_dhcp=('True') - end - - it 'should call subnet-update to change dns_nameservers' do - provider.expects(:auth_neutron).with('subnet-update', - [subnet_name, - '--dns-nameservers', - 'list=true', - '9.9.9.9']) - provider.dns_nameservers=(['9.9.9.9']) - end - - it 'should call subnet-update to change host_routes' do - provider.expects(:auth_neutron).with('subnet-update', - [subnet_name, - '--host-routes', - 'type=dict', - 'list=true', - 'destination=12.0.0.0/24,nexthop=10.0.0.2']) - provider.host_routes=(['destination=12.0.0.0/24,nexthop=10.0.0.2']) - end - - it 'should not update if dns_nameservers are empty' do - provider.dns_nameservers=('') - end - - it 'should not update if host_routes are empty' do - provider.host_routes=('') - end - end - - describe 'when updating a subnet (reverse)' do - let :subnet_attrs_mod do - subnet_attrs.merge!({:enable_dhcp => 'True'}) - end - let :resource do - Puppet::Type::Neutron_subnet.new(subnet_attrs_mod) - end - - let :provider do - provider_class.new(resource) - end - - - it 'should call subnet-update to change enable_dhcp' do - provider.expects(:auth_neutron).with('subnet-update', - '--disable-dhcp', - subnet_name) - provider.enable_dhcp=('False') - end - end -end