コード例 #1
0
ファイル: test_jungle.py プロジェクト: isotoma/jungle
 def test_initialise(self):
     with multipatch('os.symlink', 'os.rename') as m:
         m['os.listdir'].return_value = ['1.0']
         m['os.path.exists'].side_effect = self._exists("/t/current")
         m['os.path.isdir'].return_value = True
         j = Jungle("/t")
         j.initialise()
         m['os.symlink'].assert_called_with('release/1.0', '/t/current.new')
         m['os.rename'].assert_called_with("/t/current.new", "/t/current")
コード例 #2
0
ファイル: test_jungle.py プロジェクト: isotoma/jungle
 def test_set(self):        
     with multipatch('os.symlink', 'os.rename') as m:
         self._pass_current_checks(m)
         m['os.listdir'].return_value = ['1.0']
         m['os.path.exists'].side_effect = self._exists("/t/current")
         j = Jungle("/t")
         j.initialise()
         m['os.symlink'].assert_called_with('release/1.0', '/t/current.new')
         m['os.rename'].assert_called_with("/t/current.new", "/t/current")
         # now set it to 2.0
         m['os.listdir'].return_value = ['1.0', '2.0']
         m['os.path.exists'].side_effect = self._exists()
         j.set('2.0')
         m['os.symlink'].assert_called_with('release/2.0', '/t/current.new')
         m['os.rename'].assert_called_with("/t/current.new", "/t/current")