コード例 #1
0
    def test_pick_options_zero(self):
        self.options = cloudomate.options
        self.providers = cloudomate_providers.__init__

        cloudomate.options = MagicMock()
        cloudomate_providers.__init__ = MagicMock()
        cloudomate.pick_option('BlueAngelHost')
        cloudomate.options.assert_called_once()

        cloudomate.options = self.options
        cloudomate_providers.__init__ = self.providers
コード例 #2
0
    def test_pick_options(self):
        self.options = cloudomate.options
        self.providers_true = cloudomate_providers.__init__
        self.linevast = linevast.LineVast
        self.logger = Logger.log

        cloudomate.options = MagicMock(return_value=[self.Price(2), self.Price(5), self.Price(1)])
        cloudomate_providers.__init__ = MagicMock()
        Logger.log = MagicMock()

        cloudomate.pick_option('BlueAngelHost')
        Logger.log.assert_called_once()

        cloudomate_providers.__init__ = self.providers_true
        cloudomate.options = self.options
        linevast.LineVast = self.linevast
        Logger.log = self.logger