From 84479188c946ad3b741c4ad396d4111613d10e0c Mon Sep 17 00:00:00 2001
From: Ernesto Arbitrio <ernesto.arbitrio@gmail.com>
Date: Thu, 12 Dec 2024 11:18:15 -0500
Subject: [PATCH 1/3] remove warning from test_gitlab changing
 assertEquals->assertEqual

---
 tests/test_gitlab.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test_gitlab.py b/tests/test_gitlab.py
index 6c49b4e..4b401af 100644
--- a/tests/test_gitlab.py
+++ b/tests/test_gitlab.py
@@ -189,7 +189,7 @@ def test_get_pull_request_committer(self):
         committers = self.provider.get_pull_request_committer(self.repo, mr)
         actual = [a.login for a in committers]
         expected = [a['username'] for a in p]
-        self.assertEquals(actual, expected)
+        self.assertEqual(actual, expected)
 
     def test_close_pull_request(self):
         mr = MagicMock()

From a1008342f9caacb2c95ec6af6f78609576e797a6 Mon Sep 17 00:00:00 2001
From: Ernesto Arbitrio <ernesto.arbitrio@gmail.com>
Date: Thu, 12 Dec 2024 11:27:48 -0500
Subject: [PATCH 2/3] Increas coverage for test_pullrequest

---
 tests/test_pullrequest.py | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/tests/test_pullrequest.py b/tests/test_pullrequest.py
index 9e3c00f..5680c93 100644
--- a/tests/test_pullrequest.py
+++ b/tests/test_pullrequest.py
@@ -2,17 +2,18 @@
 from __future__ import absolute_import, print_function, unicode_literals
 from unittest import TestCase
 from pyup.pullrequest import PullRequest
-from datetime import datetime, timedelta
+from datetime import datetime
 
 
-def pullrequest_factory(title, state="open", url="http://foo.bar",
-                        created_at=datetime.now(), number=1):
+def pullrequest_factory(
+    title, state="open", url="http://foo.bar", created_at=datetime.now(), number=1
+):
     return PullRequest(
         title=title,
         state=state,
         url=url,
         created_at=created_at,
-        number=number
+        number=number,
     )
 
 
@@ -40,7 +41,6 @@ def test_initial(self):
     def test_unknown(self):
         pr = pullrequest_factory(title="Foo")
         self.assertEqual(pr.type, "unknown")
-        #self.assertTrue(pr.is_scheduled)
 
     def test_compile(self):
         pr = pullrequest_factory(title="Compile foo.txt")
@@ -68,6 +68,18 @@ def test_is_valid(self):
         pr = pullrequest_factory(title="Update this and that")
         self.assertTrue(pr.is_valid)
 
+    def test_config_error_type(self):
+        pr = pullrequest_factory(title="Invalid .pyup.yml")
+        self.assertEqual(pr.type, PullRequest.CONFIG_ERROR_TYPE)
+        self.assertFalse(pr.is_scheduled)
+
+    def test_is_config_error(self):
+        pr = pullrequest_factory(title="Invalid .pyup.yml")
+        self.assertTrue(pr.is_config_error)
+        pr = pullrequest_factory(title="Foo")
+        self.assertFalse(pr.is_config_error)
+
+
 class PullRequestEQTest(TestCase):
     def test_is_eq(self):
         pr1 = pullrequest_factory("yay", number=1)
@@ -110,9 +122,11 @@ def test_some_bogus(self):
 
     def test_with_prefix(self):
         pr = pullrequest_factory(title="Some Prefix | Update django")
-        self.assertEqual(pr.get_requirement("Some Prefix |"), 'django')
+        self.assertEqual(pr.get_requirement("Some Prefix |"), "django")
 
         flask = pullrequest_factory(title="Pin flask")
         flask_prefix = pullrequest_factory(title="Some Prefix | Pin flask")
         self.assertIsNotNone(flask.get_requirement())
-        self.assertEqual(flask.get_requirement(), flask_prefix.get_requirement("Some Prefix |"))
+        self.assertEqual(
+            flask.get_requirement(), flask_prefix.get_requirement("Some Prefix |")
+        )

From 901a182e222fb46517c61d20b7d12e5c49479fc6 Mon Sep 17 00:00:00 2001
From: Ernesto Arbitrio <ernesto.arbitrio@gmail.com>
Date: Thu, 12 Dec 2024 12:30:39 -0500
Subject: [PATCH 3/3] Increas coverage for test_bot

---
 tests/test_bot.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/tests/test_bot.py b/tests/test_bot.py
index a2bb0e7..4722085 100644
--- a/tests/test_bot.py
+++ b/tests/test_bot.py
@@ -158,6 +158,22 @@ def test_apply_update_pull_request_exists(self):
         bot.apply_updates(initial=True, scheduled=False)
 
         self.assertEqual(the_requirement.pull_request, the_pull)
+    
+    def test_continue_on_empty_updates(self):
+        the_requirement = Mock()
+        the_pull = pullrequest_factory("The PR")
+
+        bot = bot_factory(prs=[the_pull])
+        bot.req_bundle.get_updates = Mock()
+        update = RequirementUpdate(
+            requirement_file="foo", requirement=the_requirement, commit_message="foo"
+        )
+        bot.req_bundle.get_updates.return_value = update
+        bot.iter_updates = Mock(return_value=[[None,None,None,None]])
+        bot.apply_updates(initial=False, scheduled=False)
+        # with no updates the update.requirement.pull_request is not populated with
+        # pull_request.
+        self.assertNotEqual(the_requirement.pull_request, the_pull)
 
     def test_updates_empty(self):
         bot = bot_factory()
@@ -375,6 +391,37 @@ def test_multiple_updates_in_file(self):
         # we're looking for the sha here. Make sure that the sha got updated with the new content
         self.assertEqual(create_commit_calls[0][1]["sha"], "abcd")
         self.assertEqual(create_commit_calls[1][1]["sha"], "xyz")
+    
+    def test_repo_name_is_user_repo_full_name(self):
+        bot = bot_factory()
+        delattr(bot.user_repo, "path_with_namespace")
+        bot.user_repo.full_name = "fooname"
+        bot.provider.create_branch = Mock()
+        bot.provider.create_commit.side_effect = [
+            "sha1", "sha2", "sha3"
+        ]
+        bot.create_pull_request = Mock()
+        requirement = Mock()
+        requirement.update_content.return_value = "same content"
+        updates = [            
+            RequirementUpdate(
+                requirement_file=RequirementFile(
+                    path="foo.txt",
+                    content='same content',
+                    sha='abcd'
+                ),
+                requirement=requirement,
+                commit_message="foo"
+            )
+        ]
+
+        with patch('pyup.bot.logger.error') as mock_logger_err:
+            bot.commit_and_pull(True, "new branch", "repo", "", updates)
+        
+        assert mock_logger_err.called
+        mock_logger_err.assert_called_once_with(
+            "Empty commit at fooname, unable to update repo."
+        )
 
     def test_create_branch_fails(self):
         bot = bot_factory()