# Path: services/factory.py
# class ServicePhotoFactory(factory.django.DjangoModelFactory):
#     class Meta:
# class ServiceFactory(factory.django.DjangoModelFactory):
#     class Meta:
# class CategoryFactory(factory.django.DjangoModelFactory):
#     class Meta:
# 
# Path: semillas_backend/users/models.py
# class User(AbstractUser):
# 
#     uuid = models.UUIDField(default=uuid4, editable=False, unique=True)
#     # First Name and Last Name do not cover name patterns
#     # around the globe.
#     name = models.CharField(_('Name of User'), blank=True, max_length=255)
# 
#     phone = PhoneNumberField(blank=True)
#     phone_verified = models.BooleanField(default=False)
# 
#     location = PointField(
#         null=True,
#         blank=True,
#         help_text='User Location, only read in production user admin panel'
#     )
# 
#     location_manually_set = models.BooleanField(
#         default=False,
#         help_text="Flag indicating whether the user has introduced their location or not"
#     )
# 
#     def user_photo_upload(instance, filename):
#         extension = os.path.splitext(filename)[1]
#         return "media/users/%s-%s%s" % (str(instance.id), str(randint(0, 9999)), extension)
# 
#     picture = models.ImageField(
#         null=True,
#         blank=True,
#         help_text='Profile Picture',
#         upload_to=user_photo_upload,
#     )
# 
#     faircoin_address = models.CharField(
#         max_length=36,
#         blank=True,
#         validators=[is_blockchain_address]
#     )
# 
#     telegram_id = models.CharField(
#         blank=True,
#         max_length=60,
#         validators=[starts_with_at],
#         help_text="Telegram Id for peer communication. Example: @username"
#     )
# 
#     def __str__(self):
#         return self.username
# 
#     def get_absolute_url(self):
#         return reverse('users:detail', kwargs={'username': self.username})


from test_plus.test import TestCase
from rest_framework.test import force_authenticate
from rest_framework.test import APIRequestFactory
from rest_framework.test import APIClient
from rest_framework.authtoken.models import Token
from django.contrib.gis.geos import Point
from django.conf import settings
from django.urls import reverse
from semillas_backend.users.factory import UserFactory
from services.factory import categories
from semillas_backend.users.models import User
        longitude = "-3.8196228"

        self.client.default_format = 'json'
        response = self.client.patch(
            reverse('api_users:update', kwargs={'uuid':
                                                str(self.users[0].uuid)}),
            {"location": {
                "latitude": latitude,
                "longitude": longitude
            }
            }
        )

        # Expect: expect queryset of services ordered by proximity
        #   self.make_user()
        self.assertEqual(
            response.status_code,
            200
        )

        self.assertIsInstance(
            response.data,
            dict
        )

        self.assertEqual(
            response.data["location"]["longitude"],
            longitude
        )
        self.assertTrue(

# Path: services/factory.py
# class ServicePhotoFactory(factory.django.DjangoModelFactory):
#     class Meta:
# class ServiceFactory(factory.django.DjangoModelFactory):
#     class Meta:
# class CategoryFactory(factory.django.DjangoModelFactory):
#     class Meta:
# 
# Path: semillas_backend/users/models.py
# class User(AbstractUser):
# 
#     uuid = models.UUIDField(default=uuid4, editable=False, unique=True)
#     # First Name and Last Name do not cover name patterns
#     # around the globe.
#     name = models.CharField(_('Name of User'), blank=True, max_length=255)
# 
#     phone = PhoneNumberField(blank=True)
#     phone_verified = models.BooleanField(default=False)
# 
#     location = PointField(
#         null=True,
#         blank=True,
#         help_text='User Location, only read in production user admin panel'
#     )
# 
#     location_manually_set = models.BooleanField(
#         default=False,
#         help_text="Flag indicating whether the user has introduced their location or not"
#     )
# 
#     def user_photo_upload(instance, filename):
#         extension = os.path.splitext(filename)[1]
#         return "media/users/%s-%s%s" % (str(instance.id), str(randint(0, 9999)), extension)
# 
#     picture = models.ImageField(
#         null=True,
#         blank=True,
#         help_text='Profile Picture',
#         upload_to=user_photo_upload,
#     )
# 
#     faircoin_address = models.CharField(
#         max_length=36,
#         blank=True,
#         validators=[is_blockchain_address]
#     )
# 
#     telegram_id = models.CharField(
#         blank=True,
#         max_length=60,
#         validators=[starts_with_at],
#         help_text="Telegram Id for peer communication. Example: @username"
#     )
# 
#     def __str__(self):
#         return self.username
# 
#     def get_absolute_url(self):
#         return reverse('users:detail', kwargs={'username': self.username})


# Path: semillas_backend/users/tests/test_views.py
from test_plus.test import TestCase
from rest_framework.test import force_authenticate
from rest_framework.test import APIRequestFactory
from rest_framework.test import APIClient
from rest_framework.authtoken.models import Token
from django.contrib.gis.geos import Point
from django.conf import settings
from django.urls import reverse
from semillas_backend.users.factory import UserFactory
from services.factory import categories
from semillas_backend.users.models import User

        longitude = "-3.8196228"

        self.client.default_format = 'json'
        response = self.client.patch(
            reverse('api_users:update', kwargs={'uuid':
                                                str(self.users[0].uuid)}),
            {"location": {
                "latitude": latitude,
                "longitude": longitude
            }
            }
        )

        # Expect: expect queryset of services ordered by proximity
        #   self.make_user()
        self.assertEqual(
            response.status_code,
            200
        )

        self.assertIsInstance(
            response.data,
            dict
        )

        self.assertEqual(
            response.data["location"]["longitude"],
            longitude
        )
        self.assertTrue(

            User.objects.get(uuid=response.data['uuid']).location_manually_set