mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
generate the streamI mock in the quic package
By doing so, we can mock private methods of the stream, so they cannot be type-asserted by users of quic-go.
This commit is contained in:
parent
54ac21fbef
commit
d2e31c04ab
19 changed files with 301 additions and 301 deletions
|
@ -4,7 +4,6 @@ import (
|
|||
"errors"
|
||||
"sort"
|
||||
|
||||
"github.com/lucas-clemente/quic-go/internal/mocks"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/qerr"
|
||||
|
||||
|
@ -20,9 +19,9 @@ var _ = Describe("Streams Map", func() {
|
|||
)
|
||||
|
||||
newStream := func(id protocol.StreamID) streamI {
|
||||
str := mocks.NewMockStreamI(mockCtrl)
|
||||
str := NewMockStreamI(mockCtrl)
|
||||
str.EXPECT().StreamID().Return(id).AnyTimes()
|
||||
c := str.EXPECT().Finished().Return(false).AnyTimes()
|
||||
c := str.EXPECT().finished().Return(false).AnyTimes()
|
||||
finishedStreams[id] = c
|
||||
return str
|
||||
}
|
||||
|
@ -245,7 +244,7 @@ var _ = Describe("Streams Map", func() {
|
|||
testErr := errors.New("test error")
|
||||
openMaxNumStreams()
|
||||
for _, str := range m.streams {
|
||||
str.(*mocks.MockStreamI).EXPECT().CloseForShutdown(testErr)
|
||||
str.(*MockStreamI).EXPECT().closeForShutdown(testErr)
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
|
@ -551,7 +550,7 @@ var _ = Describe("Streams Map", func() {
|
|||
It("does not delete streams with Close()", func() {
|
||||
str, err := m.GetOrOpenStream(55)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
str.(*mocks.MockStreamI).EXPECT().Close()
|
||||
str.(*MockStreamI).EXPECT().Close()
|
||||
str.Close()
|
||||
err = m.DeleteClosedStreams()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
@ -678,7 +677,7 @@ var _ = Describe("Streams Map", func() {
|
|||
BeforeEach(func() {
|
||||
callbackCalledForStream = callbackCalledForStream[:0]
|
||||
for i := 4; i <= 8; i++ {
|
||||
str := mocks.NewMockStreamI(mockCtrl)
|
||||
str := NewMockStreamI(mockCtrl)
|
||||
str.EXPECT().StreamID().Return(protocol.StreamID(i)).AnyTimes()
|
||||
err := m.putStream(str)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue