7 from java
.lang
import Long
9 from org
.spirit
.bean
.impl
import BotListGroupLinks
11 class testGroupLinks (junit
.framework
.TestCase
):
13 def __init__(self
, name
):
14 junit
.framework
.TestCase
.__init
__(self
, name
)
15 self
.theTestFunction
= getattr(self
, name
)
24 self
.theTestFunction()
26 def testAddNewGroupLink(self
):
27 randlinkid
= random
.randint(1, 90000)
28 newrandlink
= "%s%s.com" % ("http://www.new", randlinkid
)
30 c
= applicationContext
.getBean("radController")
32 daoGroupLinks
= c
.groupLinksDao
34 self
.assertNotNull(dao
)
35 linkGroup
= dao
.readLinkGroup("aaf9dfb546f650d5fa614156000info")
36 self
.assertNotNull(linkGroup
)
38 linkGroupId
= linkGroup
.id
39 sessionFactory
= dao
.getSessionFactory()
40 hbm_session
= sessionFactory
.openSession()
41 tx
= hbm_session
.beginTransaction()
42 linkGroupBean
= hbm_session
.load("org.spirit.bean.impl.BotListLinkGroups", linkGroupId
, None)
43 self
.assertNotNull(linkGroupBean
)
44 # Error with jython proxying, unable to save one-to-many
46 link
= BotListGroupLinks()
48 link
.urlTitle
= 'mytitle'
49 link
.mainUrl
= newrandlink
52 daoGroupLinks
.createGroupLink(link
)
56 def testGroupLinks(self
):
57 c
= applicationContext
.getBean("radController")
59 self
.assertNotNull(dao
)
61 linkGroup
= dao
.readLinkGroup("aaf9dfb546f650d5fa614156000info")
62 self
.assertNotNull(linkGroup
)
63 self
.assertEquals(linkGroup
.generatedId
, "aaf9dfb546f650d5fa614156000info")
66 testClassObject
= testGroupLinks
69 suite
= junit
.framework
.TestSuite()
70 # Edit the two class names
71 for i
in dir(testClassObject
):
72 if i
.startswith("test"):
73 p
= testClassObject(i
)