Example #1
0
    def test_attach_subscription_one_sub_available(self, monkeypatch):
        monkeypatch.setattr(subscription, "get_avail_subs", GetOneSubMocked())
        monkeypatch.setattr(utils, "let_user_choose_item",
                            LetUserChooseItemMocked())
        monkeypatch.setattr(utils, "run_subprocess", RunSubprocessMocked())

        assert subscription.attach_subscription() is True
        assert utils.let_user_choose_item.called == 0
Example #2
0
    def test_attach_subscription_available_with_activation_key(
            self, monkeypatch, caplog):
        monkeypatch.setattr(subscription, "get_avail_subs",
                            GetAvailSubsMocked())
        monkeypatch.setattr(utils, "let_user_choose_item",
                            LetUserChooseItemMocked())
        monkeypatch.setattr(utils, "run_subprocess", RunSubprocessMocked())
        monkeypatch.setattr(toolopts.tool_opts, "activation_key",
                            "dummy_activation_key")

        assert subscription.attach_subscription() is True
        assert len(caplog.records) == 1
        assert caplog.records[0].levelname == "INFO"
 def test_attach_subscription_none_available(self):
     self.assertEqual(subscription.attach_subscription(), False)
 def test_attach_subscription_available(self):
     self.assertEqual(subscription.attach_subscription(), True)
Example #5
0
    def test_attach_subscription_none_available(self, monkeypatch):
        monkeypatch.setattr(subscription, "get_avail_subs",
                            GetNoAvailSubsMocked())

        assert subscription.attach_subscription() is False
 def test_attach_subscription_available_with_activation_key(self):
     self.assertEqual(subscription.attach_subscription(), True)
 def test_attach_subscription_available_with_activation_key(self):
     self.assertEqual(subscription.attach_subscription(), True)
     self.assertEqual(len(subscription.logging.getLogger.info_msgs), 1)