[mousetrap/gnome3-wip: 43/240] Refactor camera.py and test_camera.py.
- From: Heidi Ellis <heidiellis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mousetrap/gnome3-wip: 43/240] Refactor camera.py and test_camera.py.
- Date: Mon, 8 Sep 2014 15:16:08 +0000 (UTC)
commit ec19cc2247c86c0437bcf1fda9537449d258685a
Author: Stoney Jackson <dr stoney gmail com>
Date: Fri May 16 17:01:42 2014 -0400
Refactor camera.py and test_camera.py.
src/mousetrap/core/test_camera.py | 29 +++++++++++------------------
1 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/src/mousetrap/core/test_camera.py b/src/mousetrap/core/test_camera.py
index 6c9c925..a99ddb1 100644
--- a/src/mousetrap/core/test_camera.py
+++ b/src/mousetrap/core/test_camera.py
@@ -1,33 +1,26 @@
__author__ = 'foss2serve'
import unittest
-import camera
+from .camera import Camera, CameraError
class test_camera(unittest.TestCase):
- def test_get_image_correctInput(self):
-
- #Setup
- cam = camera.Camera()
-
- #Capture Image
- img = cam.get_image()
+ def setUp(self):
+ self.camera = Camera()
+ def test_get_image_withStart_imageReturned(self):
+ self.camera.start_camera();
+ image = self.camera.get_image()
self.assertTrue(
- img is not None,
+ image is not None,
msg="Error: Image not captured"
)
- def test_start_camera_correctInput(self):
-
- #Setup
- cam = camera.Camera()
+ def test_get_image_withoutStart_expectError(self):
+ with self.assertRaises(CameraError):
+ self.camera.get_image()
- self.assertTrue(
- cam.capture.isOpened(),
- msg="Error: Camera feed not initialized"
- )
if __name__ == '__main__':
- unittest.main()
\ No newline at end of file
+ unittest.main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]