Ejemplo n.º 1
0
    def test_put(self):
        person = PersonFactory.create()
        db.session.commit()
        person_attributes = PersonFactory.attributes()
        person_attributes["name"] = "Bob updated"

        self.client.put("/people/%s/" % person.id, data=json.dumps(person_attributes),
                        content_type='application/json')

        # Check for the person in the database
        person = Person.query.first()
        expect(person.name).to(equal("Bob updated"))
Ejemplo n.º 2
0
    def test_post(self):
        person_attributes = PersonFactory.attributes()
        person_attributes["name"] = "Bob Nolan"

        # Set up the data for posting the person

        headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
        self.client.post("/people/", data=json.dumps(person_attributes), headers=headers)

        # Check for the person in the database
        person = Person.query.filter_by(name='Bob Nolan').first()
        expect(person).not_to(equal(None))
Ejemplo n.º 3
0
    def test_put(self):
        person = PersonFactory.create()
        db.session.commit()
        person_attributes = PersonFactory.attributes()
        person_attributes["name"] = "Bob updated"

        self.client.put("/people/%s/" % person.id,
                        data=json.dumps(person_attributes),
                        content_type='application/json')

        # Check for the person in the database
        person = Person.query.first()
        expect(person.name).to(equal("Bob updated"))
Ejemplo n.º 4
0
    def test_post(self):
        person_attributes = PersonFactory.attributes()
        person_attributes["name"] = "Bob Nolan"

        # Set up the data for posting the person

        headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
        self.client.post("/people/",
                         data=json.dumps(person_attributes),
                         headers=headers)

        # Check for the person in the database
        person = Person.query.filter_by(name='Bob Nolan').first()
        expect(person).not_to(equal(None))