def test_update_all_restricted_in_file(self): self.assertTrue(self.update.should_update(self.req1, self.req_file)) self.config.requirements = [ RequirementConfig(path="requirements.txt", update="insecure") ] self.assertFalse(self.update.should_update(self.req1, self.req_file))
def test_requirement_in_config(self): bot = bot_factory() bot.config.search = False bot.config.requirements = [RequirementConfig(path="foo.txt")] bot.add_requirement_file = Mock() bot.get_all_requirements() self.assertEqual(bot.add_requirement_file.called, True) bot.add_requirement_file.assert_called_once_with("foo.txt")
def test_can_pin(self): config = Config() config.requirements = [RequirementConfig(path="foo.txt", pin=False)] self.assertEqual(config.can_pin("foo.txt"), False) config.pin = False config.requirements[0].pin = True self.assertEqual(config.can_pin("foo.txt"), True) self.assertEqual(config.can_pin("other.txt"), False)
def test_can_update_all(self): config = Config() config.requirements = [ RequirementConfig(path="foo.txt", update="insecure") ] self.assertEqual(config.can_update_all("foo.txt"), False) config.update = "insecure" config.requirements[0].update = "all" self.assertEqual(config.can_update_all("foo.txt"), True) self.assertEqual(config.can_update_all("other.txt"), False)
def test_repr(self): config = RequirementConfig(path="foo.txt") self.assertEqual(config.__repr__(), str(config.__dict__))