Example #1
0
    def test_delete(self):
        photo = self.create_photo(title="Lorem", caption="Lorem ipsum dolor.")
        id = photo.id

        assert Photo.find_by_id(id) is not None

        rv = self.app.delete("/api/photos/%s/" % id)
        obj = json.loads(rv.data)

        assert obj == True
        assert Photo.find_by_id(id) is None
    def test_delete(self):
        photo = self.create_photo(title="Lorem", caption="Lorem ipsum dolor.")
        id = photo.id

        assert Photo.find_by_id(id) is not None

        rv = self.app.delete("/api/photos/%s/" % id)
        obj = json.loads(rv.data)

        assert obj == True
        assert Photo.find_by_id(id) is None
Example #3
0
    def test_put_json(self):
        photo = self.create_photo(title="Lorem", caption="Lorem ipsum dolor.")
        id = photo.id
        rv = self.app.put("/api/photos/%s/" % id, data=json.dumps({ 'title': 'Foobar' }), content_type='application/json')
        assert rv.status_code == 200

        photo = Photo.find_by_id(id)
        assert photo.title == 'Foobar'
    def test_put_json(self):
        photo = self.create_photo(title="Lorem", caption="Lorem ipsum dolor.")
        id = photo.id
        rv = self.app.put("/api/photos/%s/" % id, data=json.dumps({"title": "Foobar"}), content_type="application/json")
        assert rv.status_code == 200

        photo = Photo.find_by_id(id)
        assert photo.title == "Foobar"
    def test_put_form(self):
        photo = self.create_photo(title="Lorem", caption="Lorem ipsum dolor.")
        id = photo.id
        rv = self.app.put("/api/photos/%s/" % id, data={"title": "Foobar"})
        assert rv.status_code == 200

        photo = Photo.find_by_id(id)
        self.assertEqual(photo.title, "Foobar")
Example #6
0
    def test_put_form(self):
        photo = self.create_photo(title="Lorem", caption="Lorem ipsum dolor.")
        id = photo.id
        rv = self.app.put("/api/photos/%s/" % id, data={
            'title': 'Foobar',
        })
        assert rv.status_code == 200

        photo = Photo.find_by_id(id)
        self.assertEqual(photo.title, 'Foobar')