2022-08-02 13:35:37 +00:00
|
|
|
#!env/bin/python
|
|
|
|
import os, sys
|
|
|
|
sys.path.append( os.path.abspath( "." ) )
|
|
|
|
|
|
|
|
from botanjs.service.jwork import app, JWork
|
|
|
|
from botanjs.config import Config as config
|
|
|
|
|
|
|
|
SiteRoot = os.path.abspath( "." )
|
|
|
|
|
|
|
|
# Setting the SiteRoot for config
|
|
|
|
config["Paths"]["SiteRoot"] = SiteRoot
|
|
|
|
|
|
|
|
jsCache = config["Paths"]["Cache"]
|
|
|
|
jsRoot = config["BotanJS"]["SrcDir"]
|
|
|
|
|
|
|
|
bmap = os.path.join( jsCache, "botanjs", "bmap.xml" )
|
|
|
|
|
|
|
|
app.conf.update( broker_url = config["BotanJS"]["CeleryBroker"] )
|
|
|
|
|
|
|
|
JWork.buildClassMap.delay( jsRoot, bmap )
|
|
|
|
|
|
|
|
from botanjs.service.jclassresv import BotanClassResolver as JCResv
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
class TestStringMethods( unittest.TestCase ):
|
|
|
|
|
|
|
|
# Run each twice to test the cache capabilities
|
|
|
|
def test_ojscall( self ):
|
2022-08-02 14:46:44 +00:00
|
|
|
srv = JCResv( JWork, jsRoot, bmap, jsCache )
|
2022-08-02 13:35:37 +00:00
|
|
|
for _ in range(0,2):
|
2022-08-02 14:46:44 +00:00
|
|
|
s = srv.getAPI( "System", mode = "rjs" )
|
|
|
|
if not ( "BotanJS.define( \"System\" );" in s ):
|
|
|
|
print( "A---------------------" )
|
|
|
|
print( s )
|
|
|
|
print( "B---------------------" )
|
|
|
|
self.assertTrue( False)
|
2022-08-02 13:35:37 +00:00
|
|
|
|
|
|
|
def test_import( self ):
|
2022-08-02 14:46:44 +00:00
|
|
|
srv = JCResv( JWork, jsRoot, bmap, jsCache )
|
2022-08-02 13:35:37 +00:00
|
|
|
for _ in range(0,2):
|
2022-08-02 14:46:44 +00:00
|
|
|
s = srv.getAPI( "System.Policy", mode = "rjs" )
|
2022-08-02 13:35:37 +00:00
|
|
|
self.assertTrue( "BotanJS.define( \"System.Policy\" );" in s )
|
|
|
|
self.assertTrue( "BotanJS.define( \"System.Global\" );" in s )
|
|
|
|
|
|
|
|
def test_cssInheritance( self ):
|
2022-08-02 14:46:44 +00:00
|
|
|
srv = JCResv( JWork, jsRoot, bmap, jsCache )
|
2022-08-02 13:35:37 +00:00
|
|
|
for _ in range(0,2):
|
2022-08-02 14:46:44 +00:00
|
|
|
s = srv.getAPI( "System", mode = "rcss" )
|
2022-08-02 13:35:37 +00:00
|
|
|
self.assertTrue( "/* @ */" in s )
|
|
|
|
|
2022-08-02 14:46:44 +00:00
|
|
|
# def test_jsZCalls( self ):
|
|
|
|
# srv = JCResv( JWork, jsRoot, bmap, jsCache )
|
|
|
|
# for _ in range(0,2):
|
|
|
|
# s = srv.getAPI( "eJx1zsEKgzAQBNAfKvsPaaj0YE/6A4tuJbDJlM2K9O/rpcUKOQ6PYSZUN9DgbE9WpZtKluJ0F57FLuFfe35jdXpwKp1xlrN/2x3gv/ZVsVBEfqHsVmmQyRNKQ6Nhm0dejtyYPVowT5PKHl2qN36PGyJ0zeUDs1BbKA==", mode = "css" )
|
|
|
|
# print( s )
|
|
|
|
|
2022-08-02 13:35:37 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|