@@ -1006,6 +1006,24 @@ def test_search_on_price(self):
1006
1006
self .assertTrue (TestHelper .includes (collection , subscription_1000 ))
1007
1007
self .assertFalse (TestHelper .includes (collection , subscription_900 ))
1008
1008
1009
+ def test_search_on_transaction_id (self ):
1010
+ subscription_found = Subscription .create ({
1011
+ "payment_method_token" : self .credit_card .token ,
1012
+ "plan_id" : TestHelper .trialless_plan ["id" ],
1013
+ }).subscription
1014
+
1015
+ subscription_not_found = Subscription .create ({
1016
+ "payment_method_token" : self .credit_card .token ,
1017
+ "plan_id" : TestHelper .trialless_plan ["id" ],
1018
+ }).subscription
1019
+
1020
+ collection = Subscription .search (
1021
+ SubscriptionSearch .transaction_id == subscription_found .transactions [0 ].id
1022
+ )
1023
+
1024
+ self .assertTrue (TestHelper .includes (collection , subscription_found ))
1025
+ self .assertFalse (TestHelper .includes (collection , subscription_not_found ))
1026
+
1009
1027
def test_search_on_id (self ):
1010
1028
subscription_found = Subscription .create ({
1011
1029
"id" : "find_me_%s" % random .randint (1 ,1000000 ),
@@ -1026,6 +1044,26 @@ def test_search_on_id(self):
1026
1044
self .assertTrue (TestHelper .includes (collection , subscription_found ))
1027
1045
self .assertFalse (TestHelper .includes (collection , subscription_not_found ))
1028
1046
1047
+ def test_search_on_next_billing_date (self ):
1048
+ subscription_found = Subscription .create ({
1049
+ "payment_method_token" : self .credit_card .token ,
1050
+ "plan_id" : TestHelper .trialless_plan ["id" ]
1051
+ }).subscription
1052
+
1053
+ subscription_not_found = Subscription .create ({
1054
+ "payment_method_token" : self .credit_card .token ,
1055
+ "plan_id" : TestHelper .trial_plan ["id" ]
1056
+ }).subscription
1057
+
1058
+ next_billing_date_cutoff = datetime .today () + timedelta (days = 5 )
1059
+
1060
+ collection = Subscription .search (
1061
+ SubscriptionSearch .next_billing_date >= next_billing_date_cutoff
1062
+ )
1063
+
1064
+ self .assertTrue (TestHelper .includes (collection , subscription_found ))
1065
+ self .assertFalse (TestHelper .includes (collection , subscription_not_found ))
1066
+
1029
1067
def test_retryCharge_without_amount__deprecated (self ):
1030
1068
subscription = Subscription .create ({
1031
1069
"payment_method_token" : self .credit_card .token ,
0 commit comments