mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-16 04:54:42 +00:00
@@ -1,7 +1,6 @@
|
||||
package handler_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/micro/services/threads/handler"
|
||||
@@ -16,7 +15,7 @@ func TestDeleteConversation(t *testing.T) {
|
||||
|
||||
// seed some data
|
||||
var cRsp pb.CreateConversationResponse
|
||||
err := h.CreateConversation(context.TODO(), &pb.CreateConversationRequest{
|
||||
err := h.CreateConversation(microAccountCtx(), &pb.CreateConversationRequest{
|
||||
Topic: "HelloWorld", GroupId: uuid.New().String(),
|
||||
}, &cRsp)
|
||||
if err != nil {
|
||||
@@ -25,24 +24,24 @@ func TestDeleteConversation(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("MissingID", func(t *testing.T) {
|
||||
err := h.DeleteConversation(context.TODO(), &pb.DeleteConversationRequest{}, &pb.DeleteConversationResponse{})
|
||||
err := h.DeleteConversation(microAccountCtx(), &pb.DeleteConversationRequest{}, &pb.DeleteConversationResponse{})
|
||||
assert.Equal(t, handler.ErrMissingID, err)
|
||||
})
|
||||
|
||||
t.Run("Valid", func(t *testing.T) {
|
||||
err := h.DeleteConversation(context.TODO(), &pb.DeleteConversationRequest{
|
||||
err := h.DeleteConversation(microAccountCtx(), &pb.DeleteConversationRequest{
|
||||
Id: cRsp.Conversation.Id,
|
||||
}, &pb.DeleteConversationResponse{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = h.ReadConversation(context.TODO(), &pb.ReadConversationRequest{
|
||||
err = h.ReadConversation(microAccountCtx(), &pb.ReadConversationRequest{
|
||||
Id: cRsp.Conversation.Id,
|
||||
}, &pb.ReadConversationResponse{})
|
||||
assert.Equal(t, handler.ErrNotFound, err)
|
||||
})
|
||||
|
||||
t.Run("Retry", func(t *testing.T) {
|
||||
err := h.DeleteConversation(context.TODO(), &pb.DeleteConversationRequest{
|
||||
err := h.DeleteConversation(microAccountCtx(), &pb.DeleteConversationRequest{
|
||||
Id: cRsp.Conversation.Id,
|
||||
}, &pb.DeleteConversationResponse{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user