From e35615391a9a09c3f48c2e9061d8097feebe1df4 Mon Sep 17 00:00:00 2001 From: Kian Parvin Date: Fri, 16 Aug 2024 08:53:43 +0200 Subject: [PATCH] feat: simplify test code --- internal/juju/jaas_test.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/internal/juju/jaas_test.go b/internal/juju/jaas_test.go index 50439225..a46b026b 100644 --- a/internal/juju/jaas_test.go +++ b/internal/juju/jaas_test.go @@ -38,8 +38,7 @@ func (s *JaasSuite) getJaasClient() jaasClient { } func (s *JaasSuite) TestAddRelations() { - ctlr := s.setupMocks(s.T()) - defer ctlr.Finish() + defer s.setupMocks(s.T()).Finish() tuples := []JaasTuple{ {Object: "object-1", Relation: "relation", Target: "target-1"}, @@ -67,8 +66,7 @@ func (s *JaasSuite) TestAddRelationsEmptySlice() { } func (s *JaasSuite) TestDeleteRelations() { - ctlr := s.setupMocks(s.T()) - defer ctlr.Finish() + defer s.setupMocks(s.T()).Finish() tuples := []JaasTuple{ {Object: "object-1", Relation: "relation", Target: "target-1"}, @@ -96,8 +94,7 @@ func (s *JaasSuite) TestDeleteRelationsEmptySlice() { } func (s *JaasSuite) TestReadRelations() { - ctlr := s.setupMocks(s.T()) - defer ctlr.Finish() + defer s.setupMocks(s.T()).Finish() tuple := JaasTuple{Object: "object-1", Relation: "relation", Target: "target-1"} // 1st request/response has no token in the request and a token in the response indicating another page is available. @@ -134,8 +131,7 @@ func (s *JaasSuite) TestReadRelationsEmptyTuple() { } func (s *JaasSuite) TestReadRelationsCancelledContext() { - ctlr := s.setupMocks(s.T()) - defer ctlr.Finish() + defer s.setupMocks(s.T()).Finish() tuple := JaasTuple{Object: "object-1", Relation: "relation", Target: "target-1"} req := ¶ms.ListRelationshipTuplesRequest{Tuple: toAPITuple(tuple)}