@@ -623,6 +623,7 @@ func (s *CustomerHandlerTestSuite) TestGetByUsageAttribution(ctx context.Context
623623 Namespace : s .namespace ,
624624 CustomerMutate : customer.CustomerMutate {
625625 Name : TestName ,
626+ Key : lo .ToPtr (TestKey ),
626627 UsageAttribution : customer.CustomerUsageAttribution {
627628 SubjectKeys : TestSubjectKeys ,
628629 },
@@ -642,8 +643,28 @@ func (s *CustomerHandlerTestSuite) TestGetByUsageAttribution(ctx context.Context
642643 require .NotNil (t , cus , "Customer must not be nil" )
643644 require .Equal (t , s .namespace , cus .Namespace , "Customer namespace must match" )
644645 require .Equal (t , createdCustomer .ID , cus .ID , "Customer ID must match" )
645- require .Equal (t , TestName , cus .Name , "Customer name must match" )
646- require .Equal (t , TestSubjectKeys , cus .UsageAttribution .SubjectKeys , "Customer usage attribution subject keys must match" )
646+
647+ // Get the customer by key
648+ cus , err = service .GetCustomerByUsageAttribution (ctx , customer.GetCustomerByUsageAttributionInput {
649+ Namespace : s .namespace ,
650+ SubjectKey : TestKey ,
651+ })
652+
653+ require .NoError (t , err , "Fetching customer must not return error" )
654+ require .NotNil (t , cus , "Customer must not be nil" )
655+ require .Equal (t , s .namespace , cus .Namespace , "Customer namespace must match" )
656+ require .Equal (t , createdCustomer .ID , cus .ID , "Customer ID must match" )
657+
658+ // Get the customer by key
659+ cus , err = service .GetCustomerByUsageAttribution (ctx , customer.GetCustomerByUsageAttributionInput {
660+ Namespace : s .namespace ,
661+ SubjectKey : TestKey ,
662+ })
663+
664+ require .NoError (t , err , "Fetching customer must not return error" )
665+ require .NotNil (t , cus , "Customer must not be nil" )
666+ require .Equal (t , s .namespace , cus .Namespace , "Customer namespace must match" )
667+ require .Equal (t , createdCustomer .ID , cus .ID , "Customer ID must match" )
647668
648669 // Get the customer by usage attribution with a non-existent subject key
649670 _ , err = service .GetCustomerByUsageAttribution (ctx , customer.GetCustomerByUsageAttributionInput {
0 commit comments