您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031
  1. # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
  2. # MIT License. See license.txt
  3. from __future__ import unicode_literals
  4. import unittest
  5. import webnotes
  6. from webnotes.test_runner import make_test_records
  7. class TestDB(unittest.TestCase):
  8. def test_get_value(self):
  9. from webnotes.utils import now_datetime
  10. import time
  11. webnotes.conn.sql("""delete from `tabProfile` where name not in ('Administrator', 'Guest')""")
  12. now = now_datetime()
  13. self.assertEquals(webnotes.conn.get_value("Profile", {"name": ["=", "Administrator"]}), "Administrator")
  14. self.assertEquals(webnotes.conn.get_value("Profile", {"name": ["like", "Admin%"]}), "Administrator")
  15. self.assertEquals(webnotes.conn.get_value("Profile", {"name": ["!=", "Guest"]}), "Administrator")
  16. self.assertEquals(webnotes.conn.get_value("Profile", {"modified": ["<", now]}), "Administrator")
  17. self.assertEquals(webnotes.conn.get_value("Profile", {"modified": ["<=", now]}), "Administrator")
  18. time.sleep(2)
  19. if "Profile" in webnotes.test_objects:
  20. del webnotes.test_objects["Profile"]
  21. make_test_records("Profile")
  22. self.assertEquals("test1@example.com", webnotes.conn.get_value("Profile", {"modified": [">", now]}))
  23. self.assertEquals("test1@example.com", webnotes.conn.get_value("Profile", {"modified": [">=", now]}))