Separate apt::pin for apt::backports to allow pin by release instead of origin
[puppet-modules/puppetlabs-apt.git] / spec / classes / backports_spec.rb
index 17c86ebbba0a60d9aaed90a95f7555a84c592232..3c1f4385612f0b09a25a6da0d40ae6d8d8f4b2ce 100644 (file)
@@ -5,7 +5,8 @@ describe 'apt::backports', :type => :class do
     let :facts do
       {
         'lsbdistcodename' => 'Karmic',
-        'lsbdistid'       => 'Ubuntu'
+        'lsbdistid'       => 'Ubuntu',
+        'osfamily'        => 'Debian'
       }
     end
 
@@ -18,7 +19,12 @@ describe 'apt::backports', :type => :class do
           'repos'      => 'main universe multiverse restricted',
           'key'        => '437D05B5',
           'key_server' => 'pgp.mit.edu',
-          'pin'        => 500,
+        })
+      }
+
+      it { should contain_apt__pin('backports').with({
+          'release'  => 'karmic-backports',
+          'priority' => 500,
         })
       }
     end
@@ -36,7 +42,8 @@ describe 'apt::backports', :type => :class do
     let :facts do
       {
         'lsbdistcodename' => 'Karmic',
-        'lsbdistid'       => 'Ubuntu'
+        'lsbdistid'       => 'Ubuntu',
+        'osfamily'        => 'Debian'
       }
     end
 
@@ -46,7 +53,12 @@ describe 'apt::backports', :type => :class do
         'repos'      => 'main universe multiverse restricted',
         'key'        => '437D05B5',
         'key_server' => 'pgp.mit.edu',
-        'pin'        => 200,
+      })
+    }
+
+    it { should contain_apt__pin('backports').with({
+        'release'  => 'karmic-backports',
+        'priority' => 200,
       })
     }
   end
@@ -57,6 +69,7 @@ describe 'apt::backports', :type => :class do
       {
         'lsbdistcodename' => 'Squeeze',
         'lsbdistid'       => 'Debian',
+        'osfamily'        => 'Debian'
       }
     end
 
@@ -66,7 +79,12 @@ describe 'apt::backports', :type => :class do
         'repos'      => 'main contrib non-free',
         'key'        => '46925553',
         'key_server' => 'pgp.mit.edu',
-        'pin'        => 200,
+      })
+    }
+
+    it { should contain_apt__pin('backports').with({
+        'release'  => 'squeeze-backports',
+        'priority' => 200,
       })
     }
   end
@@ -77,6 +95,7 @@ describe 'apt::backports', :type => :class do
       {
         'lsbdistcodename' => 'debian',
         'lsbdistid'       => 'LinuxMint',
+        'osfamily'        => 'Debian'
       }
     end
 
@@ -86,7 +105,12 @@ describe 'apt::backports', :type => :class do
         'repos'      => 'main contrib non-free',
         'key'        => '46925553',
         'key_server' => 'pgp.mit.edu',
-        'pin'        => 200,
+      })
+    }
+
+    it { should contain_apt__pin('backports').with({
+        'release'  => 'wheezy-backports',
+        'priority' => 200,
       })
     }
   end
@@ -97,6 +121,7 @@ describe 'apt::backports', :type => :class do
       {
         'lsbdistcodename' => 'qiana',
         'lsbdistid'       => 'LinuxMint',
+        'osfamily'        => 'Debian'
       }
     end
 
@@ -106,7 +131,12 @@ describe 'apt::backports', :type => :class do
         'repos'      => 'main universe multiverse restricted',
         'key'        => '437D05B5',
         'key_server' => 'pgp.mit.edu',
-        'pin'        => 200,
+      })
+    }
+
+    it { should contain_apt__pin('backports').with({
+        'release'  => 'trusty-backports',
+        'priority' => 200,
       })
     }
   end
@@ -116,7 +146,8 @@ describe 'apt::backports', :type => :class do
     let :facts do
       {
         'lsbdistcodename' => 'Squeeze',
-        'lsbdistid'       => 'Debian'
+        'lsbdistid'       => 'Debian',
+        'osfamily'        => 'Debian'
       }
     end
 
@@ -134,7 +165,12 @@ describe 'apt::backports', :type => :class do
         'repos'      => 'main contrib non-free',
         'key'        => '46925553',
         'key_server' => 'pgp.mit.edu',
-        'pin'        => 200,
+      })
+    }
+
+    it { should contain_apt__pin('backports').with({
+        'release'  => 'squeeze-backports',
+        'priority' => 200,
       })
     }
   end