aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuppie2026-09-06 19:33:43 -0600
committerstuppie2026-09-06 19:33:43 -0600
commitb07720826af57f056aec3818a3646bb296a24bfd (patch)
tree83bce7bb4ed1223c9576079658bce4874cc06087
parent0645e930703a6fa01ef913a3a93720aedbe6a9f5 (diff)
downloadgeneralresearch-b07720826af57f056aec3818a3646bb296a24bfd.tar.gz
generalresearch-b07720826af57f056aec3818a3646bb296a24bfd.zip
GeoIPInformation cant make geoname_id required
-rw-r--r--generalresearch/models/thl/ipinfo.py17
-rw-r--r--tests/managers/thl/test_cashout_method.py31
-rw-r--r--tests/managers/thl/test_ipinfo.py4
3 files changed, 5 insertions, 47 deletions
diff --git a/generalresearch/models/thl/ipinfo.py b/generalresearch/models/thl/ipinfo.py
index 8fbae4c..44dd408 100644
--- a/generalresearch/models/thl/ipinfo.py
+++ b/generalresearch/models/thl/ipinfo.py
@@ -139,8 +139,7 @@ class IPInformation(BaseModel):
registered_country_iso: CountryISOLike | None = Field(
default=None,
- description="The ISO code of the country where the IP address is "
- "registered.",
+ description="The ISO code of the country where the IP address is registered.",
examples=[fake.country_code().lower()],
)
is_anonymous: bool | None = Field(
@@ -161,7 +160,7 @@ class IPInformation(BaseModel):
domain: str | None = Field(default=None, max_length=255)
isp: str | None = Field(
default=None,
- description="The Internet Service Provider associated with the " "IP address.",
+ description="The Internet Service Provider associated with the IP address.",
examples=["Comcast"],
)
@@ -249,7 +248,7 @@ class IPInformation(BaseModel):
# --- ORM ---
def model_dump_mysql(self):
- d = self.model_dump(mode="json", exclude={"geoname"})
+ d = self.model_dump(mode="json")
d["updated"] = self.updated
return d
@@ -262,13 +261,3 @@ class IPInformation(BaseModel):
class GeoIPInformation(IPInformation, IPGeoname):
model_config = ConfigDict(extra="ignore")
-
- geoname_id: PositiveInt # type: ignore[reportIncompatibleVariableOverride]
-
- @field_validator("geoname_id", mode="before")
- @classmethod
- def _coerce_geoname_id(cls, v: PositiveInt | None):
- if v is None:
- raise ValueError("GeoIPInformation can't be constructed")
-
- return v
diff --git a/tests/managers/thl/test_cashout_method.py b/tests/managers/thl/test_cashout_method.py
index 877d7b2..fc364f2 100644
--- a/tests/managers/thl/test_cashout_method.py
+++ b/tests/managers/thl/test_cashout_method.py
@@ -51,37 +51,6 @@ class TestTangoCashoutMethods:
assert len(res) == 2
-class TestAMTCashoutMethods:
-
- def test_create_and_get(
- self,
- settings: GRLBaseSettings,
- cashout_method_manager: CashoutMethodManager,
- setup_cashoutmethod_db: Callable[..., None],
- ):
- setup_cashoutmethod_db()
-
- res = cashout_method_manager.filter(payout_types=[PayoutType.AMT])
- assert len(res) == 2
-
- cm = next(x for x in res if x.name == "AMT Assignment")
- assert settings.amt_assignment_cashout_method_id == cm
-
- cm = next(x for x in res if x.name == "AMT Bonus")
- assert settings.amt_bonus_cashout_method_id == cm
-
- def test_user(
- self,
- cashout_method_manager: CashoutMethodManager,
- user_with_wallet_amt: User,
- setup_cashoutmethod_db: Callable[..., None],
- ):
- setup_cashoutmethod_db()
-
- res = cashout_method_manager.get_cashout_methods(user_with_wallet_amt)
- # This user has the 2 tango, plus amt bonus & assignment
- assert len(res) == 4
-
class TestUserCashoutMethods:
diff --git a/tests/managers/thl/test_ipinfo.py b/tests/managers/thl/test_ipinfo.py
index 47b1712..c021eb9 100644
--- a/tests/managers/thl/test_ipinfo.py
+++ b/tests/managers/thl/test_ipinfo.py
@@ -55,10 +55,10 @@ class TestIPInformationManager:
def test_create(
self,
- ip_geoname_factory: Callable[..., IPGeoname],
+ ip_information_factory: Callable[..., IPInformation],
ip_information_manager: IPInformationManager,
):
- instance = ip_geoname_factory()
+ instance = ip_information_factory()
assert isinstance(instance, IPInformation)
res = ip_information_manager.fetch_ip_information(filter_ips=[instance.ip])