@@ -54,7 +54,19 @@ def test_check_auction_without_should_start(self):
5454 auction_period = check_auction (my_test_auction , self .db , self .mapper )
5555 self .assertIsNone (auction_period )
5656
57- def test_check_auction_start_more_should_start (self ):
57+ def test_check_auction_without_auction_start_date (self ):
58+ now = datetime .now (TZ )
59+
60+ my_test_auction = deepcopy (test_auction_data )
61+
62+ my_test_auction ['auctionPeriod' ] = {}
63+ my_test_auction ['auctionPeriod' ]['shouldStartAfter' ] = (now - timedelta (days = 10 )).isoformat ()
64+
65+ auction_period = check_auction (my_test_auction , self .db , self .mapper )
66+ self .assertIn ('auctionPeriod' , auction_period )
67+ self .assertIn ('startDate' , auction_period ['auctionPeriod' ])
68+
69+ def test_check_auction_start_after_should_start (self ):
5870 now = datetime .now (TZ )
5971
6072 my_test_auction = deepcopy (test_auction_data )
@@ -133,10 +145,25 @@ def test_should_start_absent(self):
133145 self .assertIn ('lots' , lots )
134146 self .assertEqual (len (lots ['lots' ][1 ].keys ()), 0 )
135147
136- def test_check_auction_with_invalid_lots (self ):
148+ def test_auction_start_absent (self ):
149+ now = datetime .now (TZ )
150+
151+ my_test_auction = deepcopy (test_auction_data )
152+ auction_period = {
153+ 'shouldStartAfter' : (now + timedelta (days = 10 )).isoformat ()
154+ }
155+ lot = {'status' : 'active' , 'auctionPeriod' : auction_period , 'id' : '1' * 32 }
156+ my_test_auction ['lots' ] = [lot , lot ]
157+
158+ lots = check_auction (my_test_auction , self .db , self .mapper )
159+ self .assertIn ('lots' , lots )
160+ self .assertEqual (len (lots ['lots' ]), 2 )
161+
162+ def test_check_auction_with_all_invalid_lots (self ):
137163 now = datetime .now (TZ )
138164 now = now .replace (year = 2018 , month = 8 , day = 25 )
139165
166+ # no active lots
140167 my_test_auction = deepcopy (test_auction_data )
141168 auction_period = {
142169 'startDate' : now .isoformat (),
@@ -150,7 +177,7 @@ def test_check_auction_with_invalid_lots(self):
150177 lots = check_auction (my_test_auction , self .db , self .mapper )
151178 self .assertIsNone (lots )
152179
153- # should start after before auction
180+ # should_start_after before auction
154181 my_test_auction = deepcopy (test_auction_data )
155182 should_start_before = deepcopy (lot )
156183 should_start_before ['auctionPeriod' ]['startDate' ] = now .isoformat ()
0 commit comments