File tree 6 files changed +48
-9
lines changed
6 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,11 @@ class Meta:
112
112
model = Email
113
113
114
114
user = factory .SubFactory (UserFactory )
115
- email = factory .Faker ("safe_email" )
115
+
116
+ # TODO: Replace when factory_boy supports `unique`.
117
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
118
+ email = factory .Sequence (lambda _ : fake .unique .safe_email ())
119
+
116
120
verified = True
117
121
primary = True
118
122
public = False
@@ -133,4 +137,6 @@ class ProhibitedUsernameFactory(WarehouseFactory):
133
137
class Meta :
134
138
model = ProhibitedUserName
135
139
136
- name = factory .Faker ("user_name" )
140
+ # TODO: Replace when factory_boy supports `unique`.
141
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
142
+ name = factory .Sequence (lambda _ : fake .unique .user_name ())
Original file line number Diff line number Diff line change 13
13
import hashlib
14
14
15
15
import factory
16
+ import faker
16
17
17
18
from warehouse .ip_addresses .models import IpAddress
18
19
19
20
from .base import WarehouseFactory
20
21
22
+ fake = faker .Faker ()
23
+
21
24
22
25
class IpAddressFactory (WarehouseFactory ):
23
26
class Meta :
24
27
model = IpAddress
25
28
26
- ip_address = factory .Faker ("ipv4_private" )
29
+ # TODO: Replace when factory_boy supports `unique`.
30
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
31
+ ip_address = factory .Sequence (lambda _ : fake .unique .ipv4_private ())
32
+
27
33
hashed_ip_address = factory .LazyAttribute (
28
34
lambda o : hashlib .sha256 (o .ip_address .encode ("utf8" )).hexdigest ()
29
35
)
Original file line number Diff line number Diff line change 11
11
# limitations under the License.
12
12
13
13
import factory
14
+ import faker
14
15
15
16
from warehouse .oidc .models import (
16
17
ActiveStatePublisher ,
26
27
from .accounts import UserFactory
27
28
from .base import WarehouseFactory
28
29
30
+ fake = faker .Faker ()
31
+
29
32
30
33
class GitHubPublisherFactory (WarehouseFactory ):
31
34
class Meta :
@@ -82,7 +85,11 @@ class Meta:
82
85
model = GooglePublisher
83
86
84
87
id = factory .Faker ("uuid4" , cast_to = None )
85
- email = factory .Faker ("safe_email" )
88
+
89
+ # TODO: Replace when factory_boy supports `unique`.
90
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
91
+ email = factory .Sequence (lambda _ : fake .unique .safe_email ())
92
+
86
93
sub = factory .Faker ("pystr" , max_chars = 12 )
87
94
88
95
@@ -92,7 +99,11 @@ class Meta:
92
99
93
100
id = factory .Faker ("uuid4" , cast_to = None )
94
101
project_name = "fake-nonexistent-project"
95
- email = factory .Faker ("safe_email" )
102
+
103
+ # TODO: Replace when factory_boy supports `unique`.
104
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
105
+ email = factory .Sequence (lambda _ : fake .unique .safe_email ())
106
+
96
107
sub = factory .Faker ("pystr" , max_chars = 12 )
97
108
added_by = factory .SubFactory (UserFactory )
98
109
Original file line number Diff line number Diff line change @@ -107,8 +107,11 @@ class Meta:
107
107
108
108
release = factory .SubFactory (ReleaseFactory )
109
109
python_version = "source"
110
- # TODO: Replace when factory_boy supports `unique`. See https://git.io/JM6kx
110
+
111
+ # TODO: Replace when factory_boy supports `unique`.
112
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
111
113
filename = factory .Sequence (lambda _ : fake .unique .file_name ())
114
+
112
115
md5_digest = factory .LazyAttribute (
113
116
lambda o : hashlib .md5 (o .filename .encode ("utf8" )).hexdigest ()
114
117
)
Original file line number Diff line number Diff line change 13
13
import datetime
14
14
15
15
import factory
16
+ import faker
16
17
17
18
from warehouse .email .ses .models import EmailMessage , Event , EventTypes
18
19
19
20
from .base import WarehouseFactory
20
21
22
+ fake = faker .Faker ()
23
+
21
24
22
25
class EmailMessageFactory (WarehouseFactory ):
23
26
class Meta :
@@ -29,8 +32,12 @@ class Meta:
29
32
- datetime .timedelta (days = 14 ),
30
33
)
31
34
message_id = factory .Faker ("pystr" , max_chars = 12 )
32
- from_ = factory .Faker ("safe_email" )
33
- to = factory .Faker ("safe_email" )
35
+
36
+ # TODO: Replace when factory_boy supports `unique`.
37
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
38
+ from_ = factory .Sequence (lambda _ : fake .unique .safe_email ())
39
+ to = factory .Sequence (lambda _ : fake .unique .safe_email ())
40
+
34
41
subject = factory .Faker ("sentence" )
35
42
36
43
Original file line number Diff line number Diff line change 11
11
# limitations under the License.
12
12
13
13
import factory
14
+ import faker
14
15
15
16
from warehouse .subscriptions .models import (
16
17
StripeCustomer ,
23
24
24
25
from .base import WarehouseFactory
25
26
27
+ fake = faker .Faker ()
28
+
26
29
27
30
class StripeCustomerFactory (WarehouseFactory ):
28
31
class Meta :
29
32
model = StripeCustomer
30
33
31
34
id = factory .Faker ("uuid4" , cast_to = None )
32
35
customer_id = factory .Faker ("uuid4" )
33
- billing_email = factory .Faker ("safe_email" )
36
+
37
+ # TODO: Replace when factory_boy supports `unique`.
38
+ # See https://github.com/FactoryBoy/factory_boy/pull/997
39
+ billing_email = factory .Sequence (lambda _ : fake .unique .safe_email ())
34
40
35
41
36
42
class StripeSubscriptionProductFactory (WarehouseFactory ):
You can’t perform that action at this time.
0 commit comments