예제 #1
0
파일: test_charm.py 프로젝트: bac/amulet
 def test_fetch_testcharm(self):
     c = CharmCache('mytestcharm')
     with patch.object(c, 'get_charm') as get_charm:
         charm = c.fetch('myservice', 'mytestcharm')
         self.assertEqual(charm, get_charm.return_value)
         get_charm.assert_called_once_with(os.getcwd(), branch=None,
                                           series='precise')
예제 #2
0
파일: test_charm.py 프로젝트: dannf/amulet
    def test_fetch_service(self):
        c = CharmCache("mytestcharm")
        with patch.object(c, "get_charm") as get_charm:
            charm = c.fetch("myservice")
            self.assertEqual(charm, get_charm.return_value)
            get_charm.assert_called_once_with("myservice", branch=None, series="precise")

        get_charm.reset_mock()
        charm2 = c["myservice"]
        self.assertEqual(charm, charm2)
        self.assertFalse(get_charm.called)
예제 #3
0
파일: test_charm.py 프로젝트: bac/amulet
    def test_fetch_service(self):
        c = CharmCache('mytestcharm')
        with patch.object(c, 'get_charm') as get_charm:
            charm = c.fetch('myservice')
            self.assertEqual(charm, get_charm.return_value)
            get_charm.assert_called_once_with('myservice', branch=None,
                                              series='precise')

        get_charm.reset_mock()
        charm2 = c['myservice']
        self.assertEqual(charm, charm2)
        self.assertFalse(get_charm.called)
예제 #4
0
파일: test_charm.py 프로젝트: dannf/amulet
    def test_local(self):
        with patch("amulet.charm.LocalCharm") as LocalCharm:

            # Patch w/o JUJU_REPOSITORY
            with patch.dict("amulet.charm.os.environ", {"JUJU_REPOSITORY": ""}):
                CharmCache.get_charm("local:precise/mycharm")
                LocalCharm.assert_called_once_with("precise/mycharm")
                LocalCharm.reset_mock()

            # Patch w/JUJU_REPOSITORY
            with patch.dict("amulet.charm.os.environ", {"JUJU_REPOSITORY": "~/charms"}):
                CharmCache.get_charm("local:precise/mycharm")
                LocalCharm.assert_called_once_with("~/charms/precise/mycharm")
예제 #5
0
파일: test_charm.py 프로젝트: bac/amulet
    def test_local(self):
        with patch('amulet.charm.LocalCharm') as LocalCharm:

            # Patch w/o JUJU_REPOSITORY
            with patch.dict('amulet.charm.os.environ', {
                    'JUJU_REPOSITORY': ''}):
                CharmCache.get_charm('local:precise/mycharm')
                LocalCharm.assert_called_once_with('precise/mycharm')
                LocalCharm.reset_mock()

            # Patch w/JUJU_REPOSITORY
            with patch.dict('amulet.charm.os.environ', {
                    'JUJU_REPOSITORY': '~/charms'}):
                CharmCache.get_charm('local:precise/mycharm')
                LocalCharm.assert_called_once_with('~/charms/precise/mycharm')
예제 #6
0
파일: test_charm.py 프로젝트: dannf/amulet
 def test_fetch_testcharm(self):
     c = CharmCache("mytestcharm")
     with patch.object(c, "get_charm") as get_charm:
         charm = c.fetch("myservice", "mytestcharm")
         self.assertEqual(charm, get_charm.return_value)
         get_charm.assert_called_once_with(os.getcwd(), branch=None, series="precise")