def test_dir_not_created_when_exists(self):
     path = 'path'
     with mock.patch.object(index, 'open'):
         with mock.patch.object(index.os, 'mkdir') as mock_mkdir:
             with mock.patch.object(index.os.path, 'isdir',
                                    returned_value=True):
                 index.generate_index_file(path)
     self.assertFalse(mock_mkdir.called)
 def test_dir_not_created_when_exists(self):
     path = 'path'
     with mock.patch.object(index, 'open'):
         with mock.patch.object(index.os, 'mkdir') as mock_mkdir:
             with mock.patch.object(index.os.path,
                                    'isdir',
                                    returned_value=True):
                 index.generate_index_file(path)
     self.assertFalse(mock_mkdir.called)
 def test_dir_created(self):
     path = 'path'
     with mock.patch.object(index, 'open'):
         with mock.patch.object(index.os, 'mkdir') as mock_mkdir:
             index.generate_index_file(path)
     self.assertTrue(mock_mkdir.called)
 def test_dir_created(self):
     path = 'path'
     with mock.patch.object(index, 'open'):
         with mock.patch.object(index.os, 'mkdir') as mock_mkdir:
             index.generate_index_file(path)
     self.assertTrue(mock_mkdir.called)