選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

30 行
1.3 KiB

  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.local.test_objects:
  20. del webnotes.local.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]}))