Пример #1
0
    def test_thermal_still_saves_appropriate_picture_document(
            self, cs_save_picture):

        Lepton.take_still = Mock()
        snap_id = uuid.uuid4()
        group_id = uuid.uuid4()
        pic_id = uuid.uuid4()

        cs.take_thermal_still(snap_id, group_id, pic_id)

        picture_name = cs.build_picture_name(pic_id)
        picture_path = cs.build_picture_path(picture_name=picture_name,
                                             snap_id=snap_id)

        cs.save_picture.assert_called_once_with(
            {
                '_id': str(pic_id),
                'type': 'picture',
                'source': 'thermal',
                'group_id': str(group_id),
                'snap_id': str(snap_id),
                'filename': picture_name,
                'uri': ANY,
                'created': ANY
            },
            clean_up_files=True)
Пример #2
0
    def test_thermal_still_saves_appropriate_picture_document(self, cs_save_picture):

        Lepton.take_still = Mock()
        #here's how to set properties on the function we mocked out
        #  cs_save_picture.return_value = 'haha'
        snap_id = uuid.uuid4()
        group_id = uuid.uuid4()
        pic_id = uuid.uuid4()

        cs.take_thermal_still(snap_id, group_id, pic_id)

        picture_name = cs.build_picture_name(pic_id)
        picture_path = cs.build_picture_path(picture_name=picture_name, snap_id=snap_id)

        cs.save_picture.assert_called_once_with(
            {'_id': str(pic_id),
             'type': 'picture',
             'source': 'thermal',
             'group_id': str(group_id),
             'snap_id': str(snap_id),
             'filename': picture_name,
             'uri': ANY,
             'created': ANY
            }
        )
Пример #3
0
    def test_thermal_still_calls_lepton_camera_class(self):
        Lepton.take_still = Mock()
        snap_id = uuid.uuid4()
        group_id = uuid.uuid4()
        pic_id = uuid.uuid4()

        cs.take_thermal_still(snap_id, group_id, pic_id)

        pic_doc = current_app.db[str(pic_id)]
        picture_name = cs.build_picture_name(pic_id)
        picture_path = cs.build_picture_path(picture_name=picture_name, snap_id=snap_id)
        Lepton.take_still.assert_called_once_with(pic_path=picture_path)
Пример #4
0
    def test_thermal_still_calls_lepton_camera_class(self):
        Lepton.take_still = Mock()
        snap_id = uuid.uuid4()
        group_id = uuid.uuid4()
        pic_id = uuid.uuid4()

        cs.take_thermal_still(snap_id, group_id, pic_id)

        pic_doc = current_app.db[str(pic_id)]
        picture_name = cs.build_picture_name(pic_id)
        picture_path = cs.build_picture_path(picture_name=picture_name, snap_id=snap_id)
        Lepton.take_still.assert_called_once_with(pic_path=picture_path)
Пример #5
0
    def test_thermal_still_saves_appropriate_picture_document(self, cs_save_picture):

        Lepton.take_still = Mock()
        snap_id = uuid.uuid4()
        group_id = uuid.uuid4()
        pic_id = uuid.uuid4()

        cs.take_thermal_still(snap_id, group_id, pic_id)

        picture_name = cs.build_picture_name(pic_id)
        picture_path = cs.build_picture_path(picture_name=picture_name, snap_id=snap_id)

        cs.save_picture.assert_called_once_with({'_id': str(pic_id),
                                                 'type': 'picture',
                                                 'source': 'thermal',
                                                 'group_id': str(group_id),
                                                 'snap_id': str(snap_id),
                                                 'filename': picture_name,
                                                 'uri': ANY,
                                                 'created': ANY}, clean_up_files=True)