~james-page/charms/trusty/glance/lp1531102

« back to all changes in this revision

Viewing changes to unit_tests/test_glance_utils.py

  • Committer: Liam Young
  • Date: 2015-06-04 08:44:46 UTC
  • mfrom: (117 glance)
  • mto: This revision was merged to the branch mainline in revision 118.
  • Revision ID: liam.young@canonical.com-20150604084446-xsroavxpfefmfynj
Resync le charm helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    'apt_install',
24
24
    'mkdir',
25
25
    'os_release',
 
26
    'pip_install',
26
27
    'service_start',
27
28
    'service_stop',
28
29
    'service_name',
236
237
    @patch.object(utils, 'git_src_dir')
237
238
    @patch.object(utils, 'service_restart')
238
239
    @patch.object(utils, 'render')
 
240
    @patch.object(utils, 'git_pip_venv_dir')
239
241
    @patch('os.path.join')
240
242
    @patch('os.path.exists')
 
243
    @patch('os.symlink')
241
244
    @patch('shutil.copytree')
242
245
    @patch('shutil.rmtree')
243
 
    def test_git_post_install(self, rmtree, copytree, exists, join, render,
244
 
                              service_restart, git_src_dir):
 
246
    @patch('subprocess.check_call')
 
247
    def test_git_post_install(self, check_call, rmtree, copytree, symlink,
 
248
                              exists, join, venv, render, service_restart,
 
249
                              git_src_dir):
245
250
        projects_yaml = openstack_origin_git
246
251
        join.return_value = 'joined-string'
 
252
        venv.return_value = '/mnt/openstack-git/venv'
247
253
        utils.git_post_install(projects_yaml)
248
254
        expected = [
249
255
            call('joined-string', '/etc/glance'),
250
256
        ]
251
257
        copytree.assert_has_calls(expected)
 
258
        expected = [
 
259
            call('joined-string', '/usr/local/bin/glance-manage'),
 
260
        ]
 
261
        symlink.assert_has_calls(expected, any_order=True)
252
262
        glance_api_context = {
253
263
            'service_description': 'Glance API server',
254
264
            'service_name': 'Glance',
255
265
            'user_name': 'glance',
256
266
            'start_dir': '/var/lib/glance',
257
267
            'process_name': 'glance-api',
258
 
            'executable_name': '/usr/local/bin/glance-api',
 
268
            'executable_name': 'joined-string',
259
269
            'config_files': ['/etc/glance/glance-api.conf'],
260
270
            'log_file': '/var/log/glance/api.log',
261
271
        }
265
275
            'user_name': 'glance',
266
276
            'start_dir': '/var/lib/glance',
267
277
            'process_name': 'glance-registry',
268
 
            'executable_name': '/usr/local/bin/glance-registry',
 
278
            'executable_name': 'joined-string',
269
279
            'config_files': ['/etc/glance/glance-registry.conf'],
270
280
            'log_file': '/var/log/glance/registry.log',
271
281
        }