Beispiel #1
0
 def test_add_agent_with_bad_source_raises_error(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-trusty-amd64.tgz')
     with patch('agent_archive.run') as mock:
         with self.assertRaises(ValueError) as e:
             add_agents(cmd_args)
     self.assertIn('does not look like a agent', str(e.exception))
     self.assertEqual(0, mock.call_count)
Beispiel #2
0
 def test_add_agent_with_unexpected_version_raises_error(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-win2013-amd64.tgz')
     with patch('agent_archive.run') as mock:
         with self.assertRaises(ValueError) as e:
             add_agents(cmd_args)
     self.assertIn('not match an expected version', str(e.exception))
     self.assertEqual(0, mock.call_count)
 def test_add_agent_with_unexpected_version_raises_error(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-win2013-amd64.tgz')
     with patch('agent_archive.run') as mock:
         with self.assertRaises(ValueError) as e:
             add_agents(cmd_args)
     self.assertIn('not match an expected version', str(e.exception))
     self.assertEqual(0, mock.call_count)
 def test_add_agent_with_bad_source_raises_error(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-trusty-amd64.tgz')
     with patch('agent_archive.run') as mock:
         with self.assertRaises(ValueError) as e:
             add_agents(cmd_args)
     self.assertIn('does not look like a agent', str(e.exception))
     self.assertEqual(0, mock.call_count)
Beispiel #5
0
 def test_add_agent_with_existing_source_raises_error(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-win2012-amd64.tgz')
     with patch('agent_archive.is_new_version',
                side_effect=ValueError) as nv_mock:
         with self.assertRaises(ValueError):
             add_agents(cmd_args)
     agent_path = os.path.abspath(cmd_args.source_agent)
     nv_mock.assert_called_with(agent_path, None, S3_CONTAINER_FAKE,
                                verbose=False)
 def test_add_agent_with_existing_source_raises_error(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-win2012-amd64.tgz')
     with patch('agent_archive.is_new_version',
                side_effect=ValueError) as nv_mock:
         with self.assertRaises(ValueError):
             add_agents(cmd_args)
     agent_path = os.path.abspath(cmd_args.source_agent)
     nv_mock.assert_called_with(agent_path,
                                None,
                                S3_CONTAINER_FAKE,
                                verbose=False)
Beispiel #7
0
 def test_add_agent_puts_centos(self):
     cmd_args = FakeArgs(source_agent='juju-1.24.0-centos7-amd64.tgz')
     with patch('agent_archive.run', return_value='') as mock:
         with patch('agent_archive.is_new_version', autopec=True,
                    return_value=True) as nv_mock:
             add_agents(cmd_args)
     agent_path = os.path.abspath(cmd_args.source_agent)
     nv_mock.assert_called_with(agent_path, None, S3_CONTAINER_FAKE,
                                verbose=False)
     self.assertEqual(1, mock.call_count)
     agent_path = os.path.abspath(cmd_args.source_agent)
     mock.assert_called_with(
         ['put', agent_path,
          's3://juju-qa-fake/agent-archive/juju-1.24.0-centos7-amd64.tgz'],
         config=None, verbose=False, dry_run=False)
Beispiel #8
0
 def test_add_agent_puts_win(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-win2012-amd64.tgz')
     with patch('agent_archive.run', return_value='') as mock:
         with patch('agent_archive.is_new_version', autopec=True,
                    return_value=True) as nv_mock:
             add_agents(cmd_args)
     nv_mock.assert_called_with(
         os.path.abspath('juju-1.21.0-win2012-amd64.tgz'),
         None, S3_CONTAINER_FAKE, verbose=False)
     self.assertEqual(1, mock.call_count)
     output, args, kwargs = mock.mock_calls[0]
     agent_path = os.path.abspath(cmd_args.source_agent)
     self.assertEqual(
         ['put', agent_path,
          's3://juju-qa-fake/agent-archive/juju-1.21.0-win2012-amd64.tgz'],
         args[0])
 def test_add_agent_puts_win(self):
     cmd_args = FakeArgs(source_agent='juju-1.21.0-win2012-amd64.tgz')
     with patch('agent_archive.run', return_value='') as mock:
         with patch('agent_archive.is_new_version',
                    autopec=True,
                    return_value=True) as nv_mock:
             add_agents(cmd_args)
     nv_mock.assert_called_with(
         os.path.abspath('juju-1.21.0-win2012-amd64.tgz'),
         None,
         S3_CONTAINER_FAKE,
         verbose=False)
     self.assertEqual(1, mock.call_count)
     output, args, kwargs = mock.mock_calls[0]
     agent_path = os.path.abspath(cmd_args.source_agent)
     self.assertEqual([
         'put', agent_path,
         's3://juju-qa-fake/agent-archive/juju-1.21.0-win2012-amd64.tgz'
     ], args[0])
 def test_add_agent_puts_centos(self):
     cmd_args = FakeArgs(source_agent='juju-1.24.0-centos7-amd64.tgz')
     with patch('agent_archive.run', return_value='') as mock:
         with patch('agent_archive.is_new_version',
                    autopec=True,
                    return_value=True) as nv_mock:
             add_agents(cmd_args)
     agent_path = os.path.abspath(cmd_args.source_agent)
     nv_mock.assert_called_with(agent_path,
                                None,
                                S3_CONTAINER_FAKE,
                                verbose=False)
     self.assertEqual(1, mock.call_count)
     agent_path = os.path.abspath(cmd_args.source_agent)
     mock.assert_called_with([
         'put', agent_path,
         's3://juju-qa-fake/agent-archive/juju-1.24.0-centos7-amd64.tgz'
     ],
                             config=None,
                             verbose=False,
                             dry_run=False)