Ver a proveniência

[tests] reset frappe.local.form_dict

version-14
Rushabh Mehta há 8 anos
ascendente
cometimento
eac06ccd77
2 ficheiros alterados com 4 adições e 4 eliminações
  1. +4
    -3
      frappe/core/doctype/authentication_log/test_authentication_log.py
  2. +0
    -1
      frappe/printing/doctype/print_format/test_print_format.py

+ 4
- 3
frappe/core/doctype/authentication_log/test_authentication_log.py Ver ficheiro

@@ -13,9 +13,8 @@ class TestAuthenticationLog(unittest.TestCase):
from frappe.auth import LoginManager, CookieManager from frappe.auth import LoginManager, CookieManager


# test user login log # test user login log
frappe.local.form_dict = frappe._dict(cmd='login')

frappe.form_dict = frappe._dict({
frappe.local.form_dict = frappe._dict({
'cmd': 'login'
'sid': 'Guest', 'sid': 'Guest',
'pwd': 'admin', 'pwd': 'admin',
'usr': 'Administrator' 'usr': 'Administrator'
@@ -38,6 +37,8 @@ class TestAuthenticationLog(unittest.TestCase):
auth_log = self.get_auth_log() auth_log = self.get_auth_log()
self.assertEquals(auth_log.status, 'Failed') self.assertEquals(auth_log.status, 'Failed')


frappe.local.form_dict = _dict()

def get_auth_log(self, operation='Login'): def get_auth_log(self, operation='Login'):
names = frappe.db.sql_list("""select name from `tabAuthentication Log` names = frappe.db.sql_list("""select name from `tabAuthentication Log`
where user='Administrator' and operation='{operation}' order by where user='Administrator' and operation='{operation}' order by


+ 0
- 1
frappe/printing/doctype/print_format/test_print_format.py Ver ficheiro

@@ -11,7 +11,6 @@ test_records = frappe.get_test_records('Print Format')
class TestPrintFormat(unittest.TestCase): class TestPrintFormat(unittest.TestCase):
def test_print_user(self, style=None): def test_print_user(self, style=None):
print_html = frappe.get_print("User", "Administrator", style=style) print_html = frappe.get_print("User", "Administrator", style=style)
print(print_html)
self.assertTrue("<label>First Name</label>" in print_html) self.assertTrue("<label>First Name</label>" in print_html)
self.assertTrue(re.findall('<div class="col-xs-7[^"]*">[\s]*administrator[\s]*</div>', print_html)) self.assertTrue(re.findall('<div class="col-xs-7[^"]*">[\s]*administrator[\s]*</div>', print_html))
return print_html return print_html


Carregando…
Cancelar
Guardar