We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
{FEAT}: Automated testing with actions.
### Idea summary

Usage of GitHub actions.

### Further details

We can use GitHub Actions to check/test the code that is being pushed upstream via PRs and it can be tested before merging automatically (Technically it is Continuous Integration).

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `project/accounts/models.py`
Content:
```
1 from django.contrib.auth.models import AbstractUser
2 import os
3 import io
4 from django.core.files.storage import default_storage
5 from django.conf import settings
6 from django.db import models
7 from PIL import Image, ImageOps
8 from django.core.files.uploadedfile import InMemoryUploadedFile
9 
10 from taggit.managers import TaggableManager
11 
12 from api.models.category import Category
13 from common.utils import PathAndRename
14 
15 
16 class User(AbstractUser):
17     """
18     A new custom User model for any functionality needed in the future. Extending AbstractUser
19     allows for adding new fields to the user model as needed.
20     """
21 
22     class Meta:
23         db_table = "users"
24 
25 
26 # Image manipulation constants
27 PROFILE_IMG_SIZE = (171, 171)
28 PROFILE_IMG_THUMB_SIZE = (40, 40)
29 WHITE_BG = (255, 255, 255)
30 
31 
32 class ProfileManager(models.Manager):
33     def summarize(self, profile):
34         from api.models.civi import Civi
35 
36         data = {
37             "username": profile.user.username,
38             "first_name": profile.first_name,
39             "last_name": profile.last_name,
40             "about_me": profile.about_me,
41             "history": [
42                 Civi.objects.serialize(c)
43                 for c in Civi.objects.filter(author_id=profile.id).order_by("-created")
44             ],
45             "profile_image": profile.profile_image_url,
46             "followers": self.followers(profile),
47             "following": self.following(profile),
48         }
49         return data
50 
51     def chip_summarize(self, profile):
52         data = {
53             "username": profile.user.username,
54             "first_name": profile.first_name,
55             "last_name": profile.last_name,
56             "profile_image": profile.profile_image_url,
57         }
58         return data
59 
60     def card_summarize(self, profile, request_profile):
61         # Length at which to truncate 'about me' text
62         about_me_truncate_length = 150
63 
64         # If 'about me' text is longer than 150 characters... add elipsis (truncate)
65         ellipsis_if_too_long = (
66             "" if len(profile.about_me) <= about_me_truncate_length else "..."
67         )
68 
69         data = {
70             "id": profile.user.id,
71             "username": profile.user.username,
72             "first_name": profile.first_name,
73             "last_name": profile.last_name,
74             "about_me": profile.about_me[:about_me_truncate_length] + ellipsis_if_too_long,
75             "profile_image": profile.profile_image_url,
76             "follow_state": True
77             if profile in request_profile.following.all()
78             else False,
79             "request_profile": request_profile.first_name,
80         }
81         return data
82 
83     def followers(self, profile):
84         return [self.chip_summarize(follower) for follower in profile.followers.all()]
85 
86     def following(self, profile):
87         return [self.chip_summarize(following) for following in profile.following.all()]
88 
89 
90 profile_upload_path = PathAndRename("")
91 
92 
93 class Profile(models.Model):
94     user = models.ForeignKey(User, on_delete=models.CASCADE)
95     first_name = models.CharField(max_length=63, blank=False)
96     last_name = models.CharField(max_length=63, blank=False)
97     about_me = models.CharField(max_length=511, blank=True)
98 
99     categories = models.ManyToManyField(
100         Category, related_name="user_categories", symmetrical=False
101     )
102     tags = TaggableManager()
103 
104     followers = models.ManyToManyField(
105         "self", related_name="follower", symmetrical=False
106     )
107     following = models.ManyToManyField(
108         "self", related_name="followings", symmetrical=False
109     )
110 
111     is_verified = models.BooleanField(default=False)
112     full_profile = models.BooleanField(default=False)
113 
114     objects = ProfileManager()
115     profile_image = models.ImageField(
116         upload_to=profile_upload_path, blank=True, null=True
117     )
118     profile_image_thumb = models.ImageField(
119         upload_to=profile_upload_path, blank=True, null=True
120     )
121 
122     @property
123     def full_name(self):
124         """Returns the person's full name."""
125 
126         return f"{self.first_name} {self.last_name}"
127 
128     @property
129     def profile_image_url(self):
130         """Return placeholder profile image if user didn't upload one"""
131 
132         if self.profile_image:
133             file_exists = default_storage.exists(
134                 os.path.join(settings.MEDIA_ROOT, self.profile_image.name)
135             )
136             if file_exists:
137                 return self.profile_image.url
138 
139         return "/static/img/no_image_md.png"
140 
141     @property
142     def profile_image_thumb_url(self):
143         """Return placeholder profile image if user didn't upload one"""
144 
145         if self.profile_image_thumb:
146             file_exists = default_storage.exists(
147                 os.path.join(settings.MEDIA_ROOT, self.profile_image_thumb.name)
148             )
149             if file_exists:
150                 return self.profile_image_thumb.url
151 
152         return "/static/img/no_image_md.png"
153 
154     def __init__(self, *args, **kwargs):
155         super(Profile, self).__init__(*args, **kwargs)
156 
157     def save(self, *args, **kwargs):
158         """ Image crop/resize and thumbnail creation """
159 
160         # New Profile image --
161         if self.profile_image:
162             self.resize_profile_image()
163 
164         self.full_profile = self.is_full_profile()
165 
166         super(Profile, self).save(*args, **kwargs)
167 
168     def resize_profile_image(self):
169         """
170         Resizes and crops the user uploaded image and creates a thumbnail version of it
171         """
172         profile_image_field = self.profile_image
173         image_file = io.StringIO(profile_image_field.read())
174         profile_image = Image.open(image_file)
175         profile_image.load()
176 
177         # Resize image
178         profile_image = ImageOps.fit(
179             profile_image, PROFILE_IMG_SIZE, Image.ANTIALIAS, centering=(0.5, 0.5)
180         )
181 
182         # Convert to JPG image format with white background
183         if profile_image.mode not in ("L", "RGB"):
184             white_bg_img = Image.new("RGB", PROFILE_IMG_SIZE, WHITE_BG)
185             white_bg_img.paste(profile_image, mask=profile_image.split()[3])
186             profile_image = white_bg_img
187 
188         # Save new cropped image
189         tmp_image_file = io.StringIO()
190         profile_image.save(tmp_image_file, "JPEG", quality=90)
191         tmp_image_file.seek(0)
192         self.profile_image = InMemoryUploadedFile(
193             tmp_image_file,
194             "ImageField",
195             self.profile_image.name,
196             "image/jpeg",
197             tmp_image_file.len,
198             None,
199         )
200         # Make a Thumbnail Image for the new resized image
201         thumb_image = profile_image.copy()
202         thumb_image.thumbnail(PROFILE_IMG_THUMB_SIZE, resample=Image.ANTIALIAS)
203         tmp_image_file = io.StringIO()
204         thumb_image.save(tmp_image_file, "JPEG", quality=90)
205         tmp_image_file.seek(0)
206         self.profile_image_thumb = InMemoryUploadedFile(
207             tmp_image_file,
208             "ImageField",
209             self.profile_image.name,
210             "image/jpeg",
211             tmp_image_file.len,
212             None,
213         )
214 
215     def is_full_profile(self):
216         if self.first_name and self.last_name:
217             return True
218         else:
219             return False
220
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/project/accounts/models.py b/project/accounts/models.py
--- a/project/accounts/models.py
+++ b/project/accounts/models.py
@@ -9,7 +9,7 @@
 
 from taggit.managers import TaggableManager
 
-from api.models.category import Category
+from api.models import Category
 from common.utils import PathAndRename

{"golden_diff": "diff --git a/project/accounts/models.py b/project/accounts/models.py\n--- a/project/accounts/models.py\n+++ b/project/accounts/models.py\n@@ -9,7 +9,7 @@\n \n from taggit.managers import TaggableManager\n \n-from api.models.category import Category\n+from api.models import Category\n from common.utils import PathAndRename\n", "issue": "{FEAT}: Automated testing with actions.\n### Idea summary\n\nUsage of GitHub actions.\n\n### Further details\n\nWe can use GitHub Actions to check/test the code that is being pushed upstream via PRs and it can be tested before merging automatically (Technically it is Continuous Integration).\n", "before_files": [{"content": "from django.contrib.auth.models import AbstractUser\nimport os\nimport io\nfrom django.core.files.storage import default_storage\nfrom django.conf import settings\nfrom django.db import models\nfrom PIL import Image, ImageOps\nfrom django.core.files.uploadedfile import InMemoryUploadedFile\n\nfrom taggit.managers import TaggableManager\n\nfrom api.models.category import Category\nfrom common.utils import PathAndRename\n\n\nclass User(AbstractUser):\n    \"\"\"\n    A new custom User model for any functionality needed in the future. Extending AbstractUser\n    allows for adding new fields to the user model as needed.\n    \"\"\"\n\n    class Meta:\n        db_table = \"users\"\n\n\n# Image manipulation constants\nPROFILE_IMG_SIZE = (171, 171)\nPROFILE_IMG_THUMB_SIZE = (40, 40)\nWHITE_BG = (255, 255, 255)\n\n\nclass ProfileManager(models.Manager):\n    def summarize(self, profile):\n        from api.models.civi import Civi\n\n        data = {\n            \"username\": profile.user.username,\n            \"first_name\": profile.first_name,\n            \"last_name\": profile.last_name,\n            \"about_me\": profile.about_me,\n            \"history\": [\n                Civi.objects.serialize(c)\n                for c in Civi.objects.filter(author_id=profile.id).order_by(\"-created\")\n            ],\n            \"profile_image\": profile.profile_image_url,\n            \"followers\": self.followers(profile),\n            \"following\": self.following(profile),\n        }\n        return data\n\n    def chip_summarize(self, profile):\n        data = {\n            \"username\": profile.user.username,\n            \"first_name\": profile.first_name,\n            \"last_name\": profile.last_name,\n            \"profile_image\": profile.profile_image_url,\n        }\n        return data\n\n    def card_summarize(self, profile, request_profile):\n        # Length at which to truncate 'about me' text\n        about_me_truncate_length = 150\n\n        # If 'about me' text is longer than 150 characters... add elipsis (truncate)\n        ellipsis_if_too_long = (\n            \"\" if len(profile.about_me) <= about_me_truncate_length else \"...\"\n        )\n\n        data = {\n            \"id\": profile.user.id,\n            \"username\": profile.user.username,\n            \"first_name\": profile.first_name,\n            \"last_name\": profile.last_name,\n            \"about_me\": profile.about_me[:about_me_truncate_length] + ellipsis_if_too_long,\n            \"profile_image\": profile.profile_image_url,\n            \"follow_state\": True\n            if profile in request_profile.following.all()\n            else False,\n            \"request_profile\": request_profile.first_name,\n        }\n        return data\n\n    def followers(self, profile):\n        return [self.chip_summarize(follower) for follower in profile.followers.all()]\n\n    def following(self, profile):\n        return [self.chip_summarize(following) for following in profile.following.all()]\n\n\nprofile_upload_path = PathAndRename(\"\")\n\n\nclass Profile(models.Model):\n    user = models.ForeignKey(User, on_delete=models.CASCADE)\n    first_name = models.CharField(max_length=63, blank=False)\n    last_name = models.CharField(max_length=63, blank=False)\n    about_me = models.CharField(max_length=511, blank=True)\n\n    categories = models.ManyToManyField(\n        Category, related_name=\"user_categories\", symmetrical=False\n    )\n    tags = TaggableManager()\n\n    followers = models.ManyToManyField(\n        \"self\", related_name=\"follower\", symmetrical=False\n    )\n    following = models.ManyToManyField(\n        \"self\", related_name=\"followings\", symmetrical=False\n    )\n\n    is_verified = models.BooleanField(default=False)\n    full_profile = models.BooleanField(default=False)\n\n    objects = ProfileManager()\n    profile_image = models.ImageField(\n        upload_to=profile_upload_path, blank=True, null=True\n    )\n    profile_image_thumb = models.ImageField(\n        upload_to=profile_upload_path, blank=True, null=True\n    )\n\n    @property\n    def full_name(self):\n        \"\"\"Returns the person's full name.\"\"\"\n\n        return f\"{self.first_name} {self.last_name}\"\n\n    @property\n    def profile_image_url(self):\n        \"\"\"Return placeholder profile image if user didn't upload one\"\"\"\n\n        if self.profile_image:\n            file_exists = default_storage.exists(\n                os.path.join(settings.MEDIA_ROOT, self.profile_image.name)\n            )\n            if file_exists:\n                return self.profile_image.url\n\n        return \"/static/img/no_image_md.png\"\n\n    @property\n    def profile_image_thumb_url(self):\n        \"\"\"Return placeholder profile image if user didn't upload one\"\"\"\n\n        if self.profile_image_thumb:\n            file_exists = default_storage.exists(\n                os.path.join(settings.MEDIA_ROOT, self.profile_image_thumb.name)\n            )\n            if file_exists:\n                return self.profile_image_thumb.url\n\n        return \"/static/img/no_image_md.png\"\n\n    def __init__(self, *args, **kwargs):\n        super(Profile, self).__init__(*args, **kwargs)\n\n    def save(self, *args, **kwargs):\n        \"\"\" Image crop/resize and thumbnail creation \"\"\"\n\n        # New Profile image --\n        if self.profile_image:\n            self.resize_profile_image()\n\n        self.full_profile = self.is_full_profile()\n\n        super(Profile, self).save(*args, **kwargs)\n\n    def resize_profile_image(self):\n        \"\"\"\n        Resizes and crops the user uploaded image and creates a thumbnail version of it\n        \"\"\"\n        profile_image_field = self.profile_image\n        image_file = io.StringIO(profile_image_field.read())\n        profile_image = Image.open(image_file)\n        profile_image.load()\n\n        # Resize image\n        profile_image = ImageOps.fit(\n            profile_image, PROFILE_IMG_SIZE, Image.ANTIALIAS, centering=(0.5, 0.5)\n        )\n\n        # Convert to JPG image format with white background\n        if profile_image.mode not in (\"L\", \"RGB\"):\n            white_bg_img = Image.new(\"RGB\", PROFILE_IMG_SIZE, WHITE_BG)\n            white_bg_img.paste(profile_image, mask=profile_image.split()[3])\n            profile_image = white_bg_img\n\n        # Save new cropped image\n        tmp_image_file = io.StringIO()\n        profile_image.save(tmp_image_file, \"JPEG\", quality=90)\n        tmp_image_file.seek(0)\n        self.profile_image = InMemoryUploadedFile(\n            tmp_image_file,\n            \"ImageField\",\n            self.profile_image.name,\n            \"image/jpeg\",\n            tmp_image_file.len,\n            None,\n        )\n        # Make a Thumbnail Image for the new resized image\n        thumb_image = profile_image.copy()\n        thumb_image.thumbnail(PROFILE_IMG_THUMB_SIZE, resample=Image.ANTIALIAS)\n        tmp_image_file = io.StringIO()\n        thumb_image.save(tmp_image_file, \"JPEG\", quality=90)\n        tmp_image_file.seek(0)\n        self.profile_image_thumb = InMemoryUploadedFile(\n            tmp_image_file,\n            \"ImageField\",\n            self.profile_image.name,\n            \"image/jpeg\",\n            tmp_image_file.len,\n            None,\n        )\n\n    def is_full_profile(self):\n        if self.first_name and self.last_name:\n            return True\n        else:\n            return False\n", "path": "project/accounts/models.py"}], "after_files": [{"content": "from django.contrib.auth.models import AbstractUser\nimport os\nimport io\nfrom django.core.files.storage import default_storage\nfrom django.conf import settings\nfrom django.db import models\nfrom PIL import Image, ImageOps\nfrom django.core.files.uploadedfile import InMemoryUploadedFile\n\nfrom taggit.managers import TaggableManager\n\nfrom api.models import Category\nfrom common.utils import PathAndRename\n\n\nclass User(AbstractUser):\n    \"\"\"\n    A new custom User model for any functionality needed in the future. Extending AbstractUser\n    allows for adding new fields to the user model as needed.\n    \"\"\"\n\n    class Meta:\n        db_table = \"users\"\n\n\n# Image manipulation constants\nPROFILE_IMG_SIZE = (171, 171)\nPROFILE_IMG_THUMB_SIZE = (40, 40)\nWHITE_BG = (255, 255, 255)\n\n\nclass ProfileManager(models.Manager):\n    def summarize(self, profile):\n        from api.models.civi import Civi\n\n        data = {\n            \"username\": profile.user.username,\n            \"first_name\": profile.first_name,\n            \"last_name\": profile.last_name,\n            \"about_me\": profile.about_me,\n            \"history\": [\n                Civi.objects.serialize(c)\n                for c in Civi.objects.filter(author_id=profile.id).order_by(\"-created\")\n            ],\n            \"profile_image\": profile.profile_image_url,\n            \"followers\": self.followers(profile),\n            \"following\": self.following(profile),\n        }\n        return data\n\n    def chip_summarize(self, profile):\n        data = {\n            \"username\": profile.user.username,\n            \"first_name\": profile.first_name,\n            \"last_name\": profile.last_name,\n            \"profile_image\": profile.profile_image_url,\n        }\n        return data\n\n    def card_summarize(self, profile, request_profile):\n        # Length at which to truncate 'about me' text\n        about_me_truncate_length = 150\n\n        # If 'about me' text is longer than 150 characters... add elipsis (truncate)\n        ellipsis_if_too_long = (\n            \"\" if len(profile.about_me) <= about_me_truncate_length else \"...\"\n        )\n\n        data = {\n            \"id\": profile.user.id,\n            \"username\": profile.user.username,\n            \"first_name\": profile.first_name,\n            \"last_name\": profile.last_name,\n            \"about_me\": profile.about_me[:about_me_truncate_length] + ellipsis_if_too_long,\n            \"profile_image\": profile.profile_image_url,\n            \"follow_state\": True\n            if profile in request_profile.following.all()\n            else False,\n            \"request_profile\": request_profile.first_name,\n        }\n        return data\n\n    def followers(self, profile):\n        return [self.chip_summarize(follower) for follower in profile.followers.all()]\n\n    def following(self, profile):\n        return [self.chip_summarize(following) for following in profile.following.all()]\n\n\nprofile_upload_path = PathAndRename(\"\")\n\n\nclass Profile(models.Model):\n    user = models.ForeignKey(User, on_delete=models.CASCADE)\n    first_name = models.CharField(max_length=63, blank=False)\n    last_name = models.CharField(max_length=63, blank=False)\n    about_me = models.CharField(max_length=511, blank=True)\n\n    categories = models.ManyToManyField(\n        Category, related_name=\"user_categories\", symmetrical=False\n    )\n    tags = TaggableManager()\n\n    followers = models.ManyToManyField(\n        \"self\", related_name=\"follower\", symmetrical=False\n    )\n    following = models.ManyToManyField(\n        \"self\", related_name=\"followings\", symmetrical=False\n    )\n\n    is_verified = models.BooleanField(default=False)\n    full_profile = models.BooleanField(default=False)\n\n    objects = ProfileManager()\n    profile_image = models.ImageField(\n        upload_to=profile_upload_path, blank=True, null=True\n    )\n    profile_image_thumb = models.ImageField(\n        upload_to=profile_upload_path, blank=True, null=True\n    )\n\n    @property\n    def full_name(self):\n        \"\"\"Returns the person's full name.\"\"\"\n\n        return f\"{self.first_name} {self.last_name}\"\n\n    @property\n    def profile_image_url(self):\n        \"\"\"Return placeholder profile image if user didn't upload one\"\"\"\n\n        if self.profile_image:\n            file_exists = default_storage.exists(\n                os.path.join(settings.MEDIA_ROOT, self.profile_image.name)\n            )\n            if file_exists:\n                return self.profile_image.url\n\n        return \"/static/img/no_image_md.png\"\n\n    @property\n    def profile_image_thumb_url(self):\n        \"\"\"Return placeholder profile image if user didn't upload one\"\"\"\n\n        if self.profile_image_thumb:\n            file_exists = default_storage.exists(\n                os.path.join(settings.MEDIA_ROOT, self.profile_image_thumb.name)\n            )\n            if file_exists:\n                return self.profile_image_thumb.url\n\n        return \"/static/img/no_image_md.png\"\n\n    def __init__(self, *args, **kwargs):\n        super(Profile, self).__init__(*args, **kwargs)\n\n    def save(self, *args, **kwargs):\n        \"\"\" Image crop/resize and thumbnail creation \"\"\"\n\n        # New Profile image --\n        if self.profile_image:\n            self.resize_profile_image()\n\n        self.full_profile = self.is_full_profile()\n\n        super(Profile, self).save(*args, **kwargs)\n\n    def resize_profile_image(self):\n        \"\"\"\n        Resizes and crops the user uploaded image and creates a thumbnail version of it\n        \"\"\"\n        profile_image_field = self.profile_image\n        image_file = io.StringIO(profile_image_field.read())\n        profile_image = Image.open(image_file)\n        profile_image.load()\n\n        # Resize image\n        profile_image = ImageOps.fit(\n            profile_image, PROFILE_IMG_SIZE, Image.ANTIALIAS, centering=(0.5, 0.5)\n        )\n\n        # Convert to JPG image format with white background\n        if profile_image.mode not in (\"L\", \"RGB\"):\n            white_bg_img = Image.new(\"RGB\", PROFILE_IMG_SIZE, WHITE_BG)\n            white_bg_img.paste(profile_image, mask=profile_image.split()[3])\n            profile_image = white_bg_img\n\n        # Save new cropped image\n        tmp_image_file = io.StringIO()\n        profile_image.save(tmp_image_file, \"JPEG\", quality=90)\n        tmp_image_file.seek(0)\n        self.profile_image = InMemoryUploadedFile(\n            tmp_image_file,\n            \"ImageField\",\n            self.profile_image.name,\n            \"image/jpeg\",\n            tmp_image_file.len,\n            None,\n        )\n        # Make a Thumbnail Image for the new resized image\n        thumb_image = profile_image.copy()\n        thumb_image.thumbnail(PROFILE_IMG_THUMB_SIZE, resample=Image.ANTIALIAS)\n        tmp_image_file = io.StringIO()\n        thumb_image.save(tmp_image_file, \"JPEG\", quality=90)\n        tmp_image_file.seek(0)\n        self.profile_image_thumb = InMemoryUploadedFile(\n            tmp_image_file,\n            \"ImageField\",\n            self.profile_image.name,\n            \"image/jpeg\",\n            tmp_image_file.len,\n            None,\n        )\n\n    def is_full_profile(self):\n        if self.first_name and self.last_name:\n            return True\n        else:\n            return False\n", "path": "project/accounts/models.py"}]}