Exemple #1
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))
Exemple #2
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))
Exemple #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"))
Exemple #4
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"))
Exemple #5
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"))
Exemple #6
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)
Exemple #7
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)