Esempio n. 1
0
    def setUp(self):
        self.db_fd, application.config['DATABASE'] = tempfile.mkstemp()
        application.testing = True
        self.app = application.test_client()

        with application.app_context():
            db.init_app(application)
            db.drop_all()
            db.create_all()
Esempio n. 2
0
    def test_create_edit_delete_note(self):
        with application.app_context():
            #Ensure no notes exist
            notes = db.session.query(Note).all()
            assert len(notes) == 0

            #Now create a note
            note = Note(value="test")
            db.session.add(note)

            #Query to check that it was added
            notes = db.session.query(Note).all()
            assert len(notes) == 1
Esempio n. 3
0
    def test_create_edit_delete_note(self):
        with application.app_context():
            service_request_schema = ServiceReqSchema()

            json_data = {
                'service_id': 12,
                'citizen_id': '',
                'quantity': 3,
                'channel_id': 2
            }

            service_request = service_request_schema.load(json_data)

            # Confirm a marshmallow bug, returns a dict when invalid data passed in.
            assert type(service_request) is dict