Exemplo 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"))
Exemplo n.º 2
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"))
Exemplo n.º 3
0
    def test_delete(self):
        person = PersonFactory.create()
        db.session.commit()

        self.client.delete("/people/%s/" % person.id)

        # Make sure the person is not in the database
        person_count = Person.query.count()
        expect(person_count).to(equal(0))
Exemplo n.º 4
0
    def test_delete(self):
        person = PersonFactory.create()
        db.session.commit()

        self.client.delete("/people/%s/" % person.id)

        # Make sure the person is not in the database
        person_count = Person.query.count()
        expect(person_count).to(equal(0))
Exemplo n.º 5
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))
Exemplo n.º 6
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))
Exemplo n.º 7
0
    def test_model_creation(self):
        PersonFactory.create(name="John Doe")
        db.session.commit()
        person = Person.query.filter_by(name='John Doe').first()

        expect(person.name).to(equal("John Doe"))
Exemplo n.º 8
0
    def test_get(self):
        PersonFactory.create(name="John Doe")
        db.session.commit()
        response = self.client.get("/people/")

        expect("John Doe" in response.data).to(be_true)
Exemplo n.º 9
0
    def test_get(self):
        PersonFactory.create(name="John Doe")
        db.session.commit()
        response = self.client.get("/people/")

        expect("John Doe" in response.data).to(be_true)