You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 line
821 B

  1. import unittest, sys
  2. sys.path.append('lib/py')
  3. import webnotes
  4. from webnotes.model import docfield
  5. webnotes.connect()
  6. class TestDocField(unittest.TestCase):
  7. def test_rename(self):
  8. docfield.rename('Event', 'notes', 'notes1')
  9. # check in table
  10. tf = webnotes.conn.sql("""desc tabEvent""")
  11. self.assertTrue('notes' not in [d[0] for d in tf])
  12. self.assertTrue('notes1' in [d[0] for d in tf])
  13. docfield.rename('Event', 'notes1', 'notes')
  14. def test_table_rename(self):
  15. docfield.rename('Event', 'event_individuals', 'event_users')
  16. self.assertFalse(webnotes.conn.sql("""select parent from `tabEvent User` where parentfield='event_individuals'"""))
  17. self.assertTrue(webnotes.conn.sql("""select parent from `tabEvent User` where parentfield='event_users'"""))
  18. if __name__=='__main__':
  19. unittest.main()