def test_total_file_count_for_this_month(self):
"""
tests that the current amount of new files uploaded for the current month is correct
"""
images = ['red.gif', 'blue.gif', 'green.gif', 'love.gif']
for image in images:
file_name = image
file_content_type = 'image/gif'
file_path = os.path.abspath("test/files/%s" % (file_name))
file_sha1 = Sourcefile.get_sha1_file_key(file_path)
sf = Sharedfile.create_from_file(
file_path = file_path,
file_name = file_name,
sha1_value = file_sha1,
content_type = file_content_type,
user_id = self.user.id)
month_days = calendar.monthrange(datetime.utcnow().year,datetime.utcnow().month)
start_time = datetime.utcnow().strftime("%Y-%m-01")
end_time = datetime.utcnow().strftime("%Y-%m-" + str(month_days[1]) )
self.assertEqual(self.user.uploaded_kilobytes(start_time=start_time, end_time=end_time), 72)
评论列表
文章目录