def test_save(self): user = User() user.username = '******' user.save() get_user = User.objects.get(username="******") follower = TwAccount() follower.screen_name = "test" follower.follower_id = "123456" follower.user = get_user follower.save() self.assertEqual( TwAccount.objects.filter(follower_id="123456").exists(), True) status = TwStatus() status.id = u'107809348885028864' status.twFollower = follower status.text = u'hello world' raw_time = 'Sun Aug 28 13:38:46 +0000 2011' # ts = time.strftime('%Y-%m-%d %H:%M:%S', time.strptime(raw_time,'%a %b %d %H:%M:%S +0000 %Y')) ts = '2015-11-03 05:07:07' status.created_at = ts status.save() self.assertEqual( TwStatus.objects.filter(id=u'107809348885028864').exists(), True)
def set_up(): user = User(username='******', email='*****@*****.**') user.set_password('123') user.is_active = True user.save() client = Client() client.login(username='******', password='******') client.get('/ChasingSomeone/home/') return {'client': client, 'user': user}
def test_save(self): user = User() user.username = '******' user.save() get_user = User.objects.get(username="******") follower = TwAccount() follower.screen_name = "test" follower.follower_id = "123456" follower.user = get_user follower.save() self.assertEqual(TwAccount.objects.filter(follower_id="123456").exists(), True) status = TwStatus() status.id = u'107809348885028864' status.twFollower = follower status.text = u'hello world' raw_time = 'Sun Aug 28 13:38:46 +0000 2011' # ts = time.strftime('%Y-%m-%d %H:%M:%S', time.strptime(raw_time,'%a %b %d %H:%M:%S +0000 %Y')) ts = '2015-11-03 05:07:07' status.created_at = ts status.save() self.assertEqual(TwStatus.objects.filter(id=u'107809348885028864').exists(), True)