Merge pull request #64 from mendhak/issue63-missing-cffi
[EVA-2020-02-2.git] / library / tests / test_setup.py
index 95080b6bc63293166d7a36c75b4d8a3eb6bca9f2..2aa7b4929db3a0d2711d56ee88a28b0756ae4a80 100644 (file)
@@ -1,7 +1,3 @@
-import sys
-import mock
-
-
 def test_gas_setup(GPIO, smbus):
     from enviroplus import gas
     gas._is_setup = False
 def test_gas_setup(GPIO, smbus):
     from enviroplus import gas
     gas._is_setup = False
@@ -49,7 +45,8 @@ def test_gas_read_adc_default_gain(GPIO, smbus):
     gas._is_setup = False
 
     gas.enable_adc(True)
     gas._is_setup = False
 
     gas.enable_adc(True)
-    assert gas.read_adc() == 0.255
+    gas.set_adc_gain(gas.MICS6814_GAIN)
+    assert gas.read_adc() == 0.765
 
 
 def test_gas_read_adc_str(GPIO, smbus):
 
 
 def test_gas_read_adc_str(GPIO, smbus):
@@ -59,3 +56,11 @@ def test_gas_read_adc_str(GPIO, smbus):
     gas.enable_adc(True)
     gas.set_adc_gain(2.048)
     assert 'ADC' in str(gas.read_all())
     gas.enable_adc(True)
     gas.set_adc_gain(2.048)
     assert 'ADC' in str(gas.read_all())
+
+
+def test_gas_cleanup(GPIO, smbus):
+    from enviroplus import gas
+
+    gas.cleanup()
+
+    GPIO.output.assert_called_with(gas.MICS6814_HEATER_PIN, 0)