Skip to content

Commit 356085b

Browse files
committed
fixup! test(resources): add testcase for resource queries
1 parent 8b7f4bb commit 356085b

6 files changed

Lines changed: 41 additions & 44 deletions

File tree

apps/resources/graphql/types.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
import strawberry
22
import strawberry_django
33

4-
<<<<<<< HEAD
5-
from apps.resources.models import (
6-
CaseStudy,
7-
ContactRequest,
8-
)
9-
||||||| parent of e5fc916 (test(resources): add testcase for resource queries)
10-
from apps.resources.models import (
11-
ContactRequest,
12-
CaseStudy,
13-
)
14-
=======
154
from apps.resources.models import CaseStudy, ContactRequest
16-
>>>>>>> e5fc916 (test(resources): add testcase for resource queries)
175
from utils.graphql.types import DjangoFileType
186

197

apps/resources/tests.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/resources/tests/__init__.py

Whitespace-only changes.

apps/resources/tests/mutation_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def setUpClass(cls):
4040
super().setUpClass()
4141
cls.user = UserFactory.create(email="test@gmail.com")
4242

43-
def _create_contact_request_mutation(self, data: dict[str, str], **kwargs):
43+
def _create_contact_request_mutation(self, data: dict[str, str], **kwargs: typing.Any):
4444
return self.query_check(
4545
query=self.Mutation.CREATE_CONTACT_REQUEST,
4646
variables={

apps/tool_picker/factories.py

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
import factory
1+
# pyright: reportRedeclaration=false
2+
# pyright: reportIncompatibleVariableOverride=false
3+
# pyright: reportMissingTypeArgument=false
4+
import typing
5+
6+
from factory.declarations import SubFactory
27
from factory.django import DjangoModelFactory
8+
9+
from apps.tool_picker.models import Catalog, Tool
310
from apps.user.factories import UserFactory
4-
from django.core.files.uploadedfile import SimpleUploadedFile
5-
from .models import Catalog, Tool
611

7-
class CatalogFactory(DjangoModelFactory[Catalog]):
8-
class Meta:
9-
model = Catalog
1012

11-
name = factory.Sequence(lambda n: f"Catalog {n}")
12-
description = factory.Faker("paragraph")
13-
show_in_help_me_choose = False
13+
class CatalogFactory(DjangoModelFactory):
14+
class Meta:
15+
model: type[Catalog] = Catalog
1416

15-
created_by = factory.SubFactory(UserFactory)
16-
modified_by = factory.SubFactory(UserFactory)
17+
created_by = SubFactory(UserFactory)
18+
modified_by = SubFactory(UserFactory)
1719

1820

19-
class ToolFactory(DjangoModelFactory[Tool]):
21+
class ToolFactory(DjangoModelFactory):
2022
class Meta:
21-
model = Tool
22-
23-
catalog = factory.SubFactory(CatalogFactory)
24-
25-
name = factory.Sequence(lambda n: f"Tool {n}")
26-
tagline = factory.Faker("catch_phrase")
27-
description = factory.Faker("paragraph")
28-
29-
video_link = factory.Faker("url")
30-
tool_link = factory.Faker("url")
31-
logo = SimpleUploadedFile(
32-
"logo.png",
33-
b"fake-image-content",
34-
content_type="image/png",
35-
)
36-
created_by = factory.SubFactory(UserFactory)
37-
modified_by = factory.SubFactory(UserFactory)
23+
model: type[Tool] = Tool
24+
25+
catalog = SubFactory(CatalogFactory)
26+
created_by = SubFactory(UserFactory)
27+
modified_by = SubFactory(UserFactory)
28+
29+
30+
if typing.TYPE_CHECKING:
31+
ToolFactory: type[DjangoModelFactory[Tool]]
32+
CatalogFactory: type[DjangoModelFactory[Catalog]]

schema.graphql

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@ type DjangoFileType {
138138
url: String!
139139
}
140140

141+
input IDBaseFilterLookup {
142+
"""Exact match. Filter will be skipped on `null` value"""
143+
exact: ID
144+
145+
"""Assignment test. Filter will be skipped on `null` value"""
146+
isNull: Boolean
147+
148+
"""
149+
Exact match of items in a given list. Filter will be skipped on `null` value
150+
"""
151+
inList: [ID!]
152+
}
153+
141154
type Mutation {
142155
createContactRequest(data: ContactRequestInput!): CreateContactRequestPayload! @isAuthenticated
143156
}
@@ -279,8 +292,10 @@ type ToolTypeOffsetPaginated {
279292

280293
"""Custom user model with email as unique identifier."""
281294
type UserMeType {
282-
email: String!
295+
id: ID!
283296
firstName: String!
284297
lastName: String!
285298
displayName: String!
299+
anonymizedEmail: String!
300+
email: String!
286301
}

0 commit comments

Comments
 (0)