def testDBopsAddGet(self):
     """
     Test database operations
     """
     # load some sample data
     mypoi = MyPlace()
     mypoi.name = "mytestfav"
     mypoi.address = "5100 Commerce Pkwy, Roswell, GA 30076"
     db.session.add(mypoi)
     db.session.commit()
     # now attempt to retrieve it back
     res = (MyPlace.query.filter_by(name="mytestfav")).first()
     assert res.name == "mytestfav"
    def testRESTopsPresence(self):
        """
        Test REST ops
        """
        # load some sample data
        mypoi = MyPlace()
        mypoi.name = "myrestfav"
        mypoi.address = "5100 Commerce Pkwy, Roswell, GA 30076"
        db.session.add(mypoi)
        db.session.commit()

        # there should be no one there indeed
        response = self.testapp.get('/api/noonehere')
        assert response.status_code == 404

        # there should be a valid response
        self.testapp = self.svc.app.test_client()
        response = self.testapp.get('/api/myplace', environ_base={'HTTP_USER_AGENT': 'Chrome'})
        print response.data
        assert response.status_code == 200