예제 #1
0
 def test_syncs_file(self, is_dir, is_pyfile, sync_pyfile):
     '''It correctly syncs a module file'''
     is_dir.return_value = False
     is_pyfile.return_value = True
     sync.sync(src='/tmp/charm-helpers',
               dest='hooks/charmhelpers',
               module='contrib.openstack.utils')
     sync_pyfile.assert_has_calls([
         call('/tmp/charm-helpers/charmhelpers/__init__',
              'hooks/charmhelpers'),
         call('/tmp/charm-helpers/charmhelpers/contrib/__init__',
              'hooks/charmhelpers/contrib'),
         call('/tmp/charm-helpers/charmhelpers/contrib/openstack/__init__',
              'hooks/charmhelpers/contrib/openstack'),
         call('/tmp/charm-helpers/charmhelpers/contrib/openstack/utils',
              'hooks/charmhelpers/contrib/openstack')])
예제 #2
0
    def test_syncs_directory(self, is_dir, sync_dir, sync_pyfile):
        '''It correctly syncs a module directory'''
        is_dir.return_value = True
        sync.sync(src='/tmp/charm-helpers',
                  dest='hooks/charmhelpers',
                  module='contrib.openstack')

        sync_dir.assert_called_with(
            '/tmp/charm-helpers/charmhelpers/contrib/openstack',
            'hooks/charmhelpers/contrib/openstack', None)

        # __init__.py files leading to the directory were also synced.
        sync_pyfile.assert_has_calls([
            call('/tmp/charm-helpers/charmhelpers/__init__',
                 'hooks/charmhelpers'),
            call('/tmp/charm-helpers/charmhelpers/contrib/__init__',
                 'hooks/charmhelpers/contrib')])