From f5b459c4c83cfe166ee84fb779d1b2e111d29091 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 16 Apr 2019 15:10:55 +0530 Subject: [PATCH] fix(test): comments --- frappe/core/doctype/comment/test_comment.py | 2 +- .../doctype/dashboard_chart/dashboard_chart.py | 16 ---------------- .../dashboard_chart/test_dashboard_chart.py | 11 +---------- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/frappe/core/doctype/comment/test_comment.py b/frappe/core/doctype/comment/test_comment.py index 0f46f0b3b5..2f6583b7ba 100644 --- a/frappe/core/doctype/comment/test_comment.py +++ b/frappe/core/doctype/comment/test_comment.py @@ -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( diff --git a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py index a6c8288559..217b456349 100644 --- a/frappe/desk/doctype/dashboard_chart/dashboard_chart.py +++ b/frappe/desk/doctype/dashboard_chart/dashboard_chart.py @@ -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 diff --git a/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py b/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py index d92c1a120c..ca55d9254a 100644 --- a/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py +++ b/frappe/desk/doctype/dashboard_chart/test_dashboard_chart.py @@ -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')