-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathpatch_mock.py
More file actions
71 lines (60 loc) · 2.42 KB
/
Copy pathpatch_mock.py
File metadata and controls
71 lines (60 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
with open("internal/domain/circle/mocks/repository.go", "r") as f:
content = f.read()
impls = """
func (m *Repository) CreateDispute(ctx context.Context, d *circle.Dispute) error {
return m.Called(ctx, d).Error(0)
}
func (m *Repository) GetDisputeByID(ctx context.Context, id uuid.UUID) (*circle.Dispute, error) {
args := m.Called(ctx, id)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*circle.Dispute), args.Error(1)
}
func (m *Repository) UpdateDisputeStatus(ctx context.Context, id uuid.UUID, status circle.DisputeStatus) error {
return m.Called(ctx, id, status).Error(0)
}
func (m *Repository) ListDisputesByCircle(ctx context.Context, circleID uuid.UUID) ([]circle.Dispute, error) {
args := m.Called(ctx, circleID)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).([]circle.Dispute), args.Error(1)
}
func (m *Repository) CreateVote(ctx context.Context, v *circle.CircleVote) error {
return m.Called(ctx, v).Error(0)
}
func (m *Repository) GetVotesByCircleAndRound(ctx context.Context, circleID uuid.UUID, roundNumber int) ([]circle.CircleVote, error) {
args := m.Called(ctx, circleID, roundNumber)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).([]circle.CircleVote), args.Error(1)
}
func (m *Repository) GetVoteByVoterAndRound(ctx context.Context, circleID, voterID uuid.UUID, roundNumber int) (*circle.CircleVote, error) {
args := m.Called(ctx, circleID, voterID, roundNumber)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*circle.CircleVote), args.Error(1)
}
func (m *Repository) CreateAuctionBid(ctx context.Context, b *circle.CircleAuctionBid) error {
return m.Called(ctx, b).Error(0)
}
func (m *Repository) GetAuctionBidsByCircleAndRound(ctx context.Context, circleID uuid.UUID, roundNumber int) ([]circle.CircleAuctionBid, error) {
args := m.Called(ctx, circleID, roundNumber)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).([]circle.CircleAuctionBid), args.Error(1)
}
func (m *Repository) GetAuctionBidByBidderAndRound(ctx context.Context, circleID, bidderID uuid.UUID, roundNumber int) (*circle.CircleAuctionBid, error) {
args := m.Called(ctx, circleID, bidderID, roundNumber)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*circle.CircleAuctionBid), args.Error(1)
}
"""
with open("internal/domain/circle/mocks/repository.go", "a") as f:
f.write("\n" + impls)