def test_remove_method(self): new_member = Member.create_member(invited_by='Owen', email='*****@*****.**', password='******', first_name='Owen', last_name='Carpenter', birthday='10/05/1997', address='UMass') new_member.remove_member() self.assertEqual(Member.objects.count(), 0)
def test_class_create(self): new_member = Member.create_memb(invited_by='Tamas', email='*****@*****.**', password='******', first_name='Bobby', last_name='Builder', birthday='10/03/1929', address='Nova Scotia') new_post = self.create_post("hello???", new_member) new_image = self.create_image(new_member,new_post, image) self.assertTrue(isinstance(new_image, Image)) self.assertEqual(Image.objects.count(), 2)
def test_set_points(self): new_member = Member.create_member(invited_by='Owen', email='*****@*****.**', password='******', first_name='Owen', last_name='Carpenter', birthday='10/05/1997', address='UMass') new_member = new_member.set_points(1) self.assertEqual(new_member.data().points, 1)
def test_class_create(self): new_member = Member.create_memb(invited_by='Owen', email='*****@*****.**', password='******', first_name='Owen', last_name='Carpenter', birthday='10/05/1997', address='UMass') self.assertTrue(isinstance(new_member, Member)) self.assertEqual( Member.objects.count(), 2) # Is the other get method actually saving to the database?
def be_memeber(token_type,buyer): result={'code':1,'msg':'ok'} try: data=request.get_json() if not Member.query.filter_by(shop_id=data['shop_id'],buyer_id=buyer.buyer_id).first(): memeber=Member(shop_id=data['shop_id'],buyer_id=buyer.buyer_id,create_time=datetime.now()) db.session.add(memeber) db.session.commit() except Exception,e: current_app.logger.exception(e) result['code'] = 0 result['msg'] = e.message