Пример #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"))
Пример #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))
Пример #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"))
Пример #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))