# -*- coding: utf-8 -*-
import unittest

from openprocurement.api.tests.base import snitch

from openprocurement.tender.belowthreshold.tests.base import test_organization
from openprocurement.tender.belowthreshold.tests.chronograph_blanks import (
    # TenderSwitchUnsuccessfulResourceTest
    switch_to_unsuccessful,
)

from openprocurement.tender.esco.tests.base import BaseESCOEUContentWebTest, test_bids
from openprocurement.tender.openeu.tests.chronograph_blanks import (
    # TenderComplaintSwitchResourceTest
    switch_to_complaint,
    # TenderSwitchAuctionResourceTest
    switch_to_auction,
    # TenderSwitchPreQualificationResourceTest
    pre_qual_switch_to_auction,
)

from openprocurement.tender.openua.tests.chronograph_blanks import (
    # TenderAuctionPeriodResourceTest
    set_auction_period_0bid as set_auction_period,
)


class TenderSwitchPreQualificationResourceTest(BaseESCOEUContentWebTest):
    initial_status = 'active.tendering'
    initial_bids = test_bids

    test_switch_to_auction = snitch(pre_qual_switch_to_auction)


class TenderSwitchAuctionResourceTest(BaseESCOEUContentWebTest):
    initial_status = 'active.pre-qualification.stand-still'
    initial_bids = test_bids

    test_switch_to_auction = snitch(switch_to_auction)


class TenderSwitchUnsuccessfulResourceTest(BaseESCOEUContentWebTest):
    initial_status = 'active.tendering'

    test_switch_to_unsuccessful = snitch(switch_to_unsuccessful)


class TenderAuctionPeriodResourceTest(BaseESCOEUContentWebTest):
    initial_status = 'active.tendering'

    test_set_auction_period = snitch(set_auction_period)


class TenderComplaintSwitchResourceTest(BaseESCOEUContentWebTest):
    initial_bids = test_bids
    author_data = test_organization

    test_switch_to_complaint = snitch(switch_to_complaint)


def suite():
    suite = unittest.TestSuite()
    suite.addTest(unittest.makeSuite(TenderSwitchPreQualificationResourceTest))
    suite.addTest(unittest.makeSuite(TenderSwitchAuctionResourceTest))
    suite.addTest(unittest.makeSuite(TenderSwitchUnsuccessfulResourceTest))
    suite.addTest(unittest.makeSuite(TenderAuctionPeriodResourceTest))
    suite.addTest(unittest.makeSuite(TenderComplaintSwitchResourceTest))
    return suite


if __name__ == '__main__':
    unittest.main(defaultTest='suite')

@@ -366,16 +366,22 @@
  import 
+(%0A    
 BaseESCO
@@ -407,16 +407,29 @@
 est_bids
+, test_lots%0A)
 %0Afrom op
@@ -695,16 +695,86 @@
 uction,%0A
+    pre_qual_switch_to_stand_still,%0A    active_tendering_to_pre_qual,%0A
 )%0A%0Afrom 
@@ -926,16 +926,75 @@
 period,%0A
+    set_auction_period_lot_0bid as set_auction_period_lot,%0A
 )%0A%0A%0Aclas
@@ -1189,32 +1189,295 @@
 tch_to_auction)%0A
+    test_switch_to_pre_qual = snitch(active_tendering_to_pre_qual)%0A    test_switch_to_stand_still = snitch(pre_qual_switch_to_stand_still)%0A%0A%0Aclass TenderLotSwitchPreQualificationResourceTest(TenderSwitchPreQualificationResourceTest):%0A    initial_lots = test_lots%0A
 %0A%0Aclass TenderSw
@@ -1670,24 +1670,170 @@
 _auction)%0A%0A%0A
+class TenderLotSwitchAuctionResourceTest(TenderSwitchAuctionResourceTest):%0A    initial_status = 'active.tendering'%0A    initial_lots = test_lots%0A%0A%0A
 class Tender
@@ -1994,24 +1994,180 @@
 ccessful)%0A%0A%0A
+class TenderLotSwitchUnsuccessfulResourceTest(TenderSwitchUnsuccessfulResourceTest):%0A    initial_status = 'active.tendering'%0A    initial_lots = test_lots%0A%0A%0A
 class Tender
@@ -2315,24 +2315,225 @@
 n_period)%0A%0A%0A
+class TenderLotAuctionPeriodResourceTest(BaseESCOEUContentWebTest):%0A    initial_status = 'active.tendering'%0A    initial_lots = test_lots%0A%0A    test_set_auction_period = snitch(set_auction_period_lot)%0A%0A%0A
 class Tender
@@ -2579,32 +2579,72 @@
 ontentWebTest):%0A
+    initial_status = 'active.tendering'%0A
     initial_bids
@@ -2754,16 +2754,126 @@
 aint)%0A%0A%0A
+class TenderLotComplaintSwitchResourceTest(TenderComplaintSwitchResourceTest):%0A    initial_lots = test_lots%0A%0A%0A
 def suit
@@ -3037,226 +3037,612 @@
 nder
-SwitchAuctionResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderSwitchUnsuccessfulResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderAuctionPeriodResourceTest))%0A    suite.addTest(unittest.makeSuite(Tender
+LotSwitchPreQualificationResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderSwitchAuctionResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderLotSwitchAuctionResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderSwitchUnsuccessfulResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderLotSwitchUnsuccessfulResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderAuctionPeriodResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderLotAuctionPeriodResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderComplaintSwitchResourceTest))%0A    suite.addTest(unittest.makeSuite(TenderLot
 Comp

update chronograph tests