class WinkEndpointTest(unittest.TestCase):

    def setup_class(self):
        self.gpio_factory = GPIOTestFactory( track_gpio_calls = False)
        self.app = buildTestServer(gpioFactory=self.gpio_factory).test_client()

    def test_gpio_blinks_twenty_times_in_twenty_seconds(self):
        response = self.app.get('/wink')
        self.assertEqual(response.status_code, 200)
        time.sleep(2.1)
        self.assertEqual(self.gpio_factory.getGPIO().number_of_high_calls_for_channel(13), 20)
        self.assertEqual(self.gpio_factory.getGPIO().number_of_low_calls_for_channel(13), 20)
        
class GpioInitializationTest(unittest.TestCase):

    def setup_class(self):
        self.gpioFactory = GPIOTestFactory(track_gpio_calls = True)
        self.app = buildTestServer(gpioFactory=self.gpioFactory).test_client();

    def test_gpio_pin_scheme_set(self):
        self.assertEqual(self.gpioFactory.getGPIO().gpio_pin_mode_setting(),  'BOARD')
 def setup_class(self):
     self.gpio_factory = GPIOTestFactory( track_gpio_calls = False)
     self.app = buildTestServer(gpioFactory=self.gpio_factory).test_client()