fix(test): comments
This commit is contained in:
parent
f34363956c
commit
f5b459c4c8
3 changed files with 2 additions and 27 deletions
|
|
@ -35,7 +35,7 @@ class TestComment(unittest.TestCase):
|
|||
frappe.db.sql("delete from `tabComment` where reference_doctype = 'Blog Post'")
|
||||
|
||||
from frappe.templates.includes.comments.comments import add_comment
|
||||
add_comment('hello', 'test@test.com', 'Good Tester',
|
||||
add_comment('Good comment with 10 chars', 'test@test.com', 'Good Tester',
|
||||
'Blog Post', test_blog.name, test_blog.route)
|
||||
|
||||
self.assertEqual(frappe.get_all('Comment', fields = ['*'], filters = dict(
|
||||
|
|
|
|||
|
|
@ -156,22 +156,6 @@ def get_period_ending(date, timegrain):
|
|||
|
||||
return getdate(date)
|
||||
|
||||
def get_period_beginning(date, timegrain):
|
||||
if timegrain=='Daily':
|
||||
return getdate(date)
|
||||
|
||||
ending = get_period_ending(date, timegrain)
|
||||
beginning = None
|
||||
|
||||
if timegrain=='Weekly':
|
||||
beginning = add_to_date(add_to_date(ending, weeks=-1), days = 1)
|
||||
elif timegrain=='Monthly':
|
||||
beginning = add_to_date(add_to_date(ending, months=-1), days = 1)
|
||||
elif timegrain=='Quarterly':
|
||||
beginning = add_to_date(add_to_date(ending, months=-3), days = 1)
|
||||
|
||||
return getdate(beginning)
|
||||
|
||||
def get_week_ending(date):
|
||||
# fun fact: week ends on the day before 1st Jan of the year.
|
||||
# for 2019 it is Monday
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from __future__ import unicode_literals
|
|||
import unittest, frappe
|
||||
from frappe.utils import getdate
|
||||
from frappe.desk.doctype.dashboard_chart.dashboard_chart import (get,
|
||||
get_period_ending, get_period_beginning)
|
||||
get_period_ending)
|
||||
|
||||
class TestDashboardChart(unittest.TestCase):
|
||||
def test_period_ending(self):
|
||||
|
|
@ -32,15 +32,6 @@ class TestDashboardChart(unittest.TestCase):
|
|||
self.assertEqual(get_period_ending('2019-10-01', 'Quarterly'),
|
||||
getdate('2019-12-31'))
|
||||
|
||||
def test_get_period_beginning(self):
|
||||
self.assertEqual(get_period_beginning('2019-02-02', 'Monthly'),
|
||||
getdate('2019-02-01'))
|
||||
self.assertEqual(get_period_beginning('2019-02-02', 'Quarterly'),
|
||||
getdate('2019-01-01'))
|
||||
self.assertEqual(get_period_beginning('2019-01-29', 'Weekly'),
|
||||
getdate('2019-02-01'))
|
||||
|
||||
|
||||
def test_dashboard_chart(self):
|
||||
if frappe.db.exists('Dashboard Chart', 'Test Dashboard Chart'):
|
||||
frappe.delete_doc('Dashboard Chart', 'Test Dashboard Chart')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue