~makyo/juju-deployer/machines-and-placement

« back to all changes in this revision

Viewing changes to deployer/tests/test_importer.py

  • Committer: Madison Scott-Clary
  • Date: 2015-03-24 17:38:56 UTC
  • Revision ID: matthew.scott@canonical.com-20150324173856-gy0d5ix8gtm6e792
Add series to machine spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        importer.run()
76
76
 
77
77
        self.assertFalse(env.add_relation.called, False)
 
78
 
 
79
    @skip_if_offline
 
80
    @mock.patch('deployer.action.importer.time')
 
81
    def test_importer_add_machine_series(self, mock_time):
 
82
        self.options.configs = [
 
83
            os.path.join(self.test_data_dir, 'v4', 'series.yaml')]
 
84
        stack = ConfigStack(self.options.configs)
 
85
        deploy = stack.get(self.options.configs[0])
 
86
        env = mock.MagicMock()
 
87
        importer = Importer(env, deploy, self.options)
 
88
        importer.run()
 
89
 
 
90
        self.assertEqual(env.add_machine.call_count, 2)
 
91
        self.assertEqual(
 
92
            env.add_machine.call_args_list[0][1],
 
93
            {'series': 'precise', 'constraints': 'mem=512M'})
 
94
        self.assertEqual(
 
95
            env.add_machine.call_args_list[1][1],
 
96
            {'series': 'trusty', 'constraints': 'mem=512M'})