Авторизация:
E-Mail: Пароль:
Закрыть
RU | EN

system_contracts

Опубликовано: 2018-05-17 17:54:32
Этот текст доступен по адресу: http://ontext.info/100661
def test_roll(self):
# add table
column = """[{"name":"MyName","type":"varchar",
"index": "1", "conditions":"true"}]"""
permission = """{"insert": "true",
"update" : "true","new_column": "true"}"""
tableName = "rollTab_" utils.generate_random_name()
print("tableName = " tableName)
data = {"Name": tableName,
"Columns": column, "ApplicationId": 1,
"Permissions": permission}
res = self.call("NewTable", data)
print("NewTable block = " res)
self.assertGreater(int(res), 0, "BlockId is not generated: " res)

# create contarct, wich added record in created table
code, name = utils.generate_name_and_code("")
name = "insertTab_" name
ins = "DBInsert(\"" tableName "\", \"MyName\" ,\"insert\" )"
body = """ { \n data {} \n conditions {} \n action { \n """ ins """ \n } }"""
code = "contract " name " " body
data = {"Value": code, "ApplicationId": 1,
"Conditions": "true"}
res = self.call("NewContract", data)
print("Create new insert contract block = " res)
self.assertGreater(int(res), 0, "BlockId is not generated: " res)

# call contarct, wich added record in created table
res = self.call(name, data)
print("Added insert = " res)
self.assertGreater(int(res), 0, "BlockId is not generated: " res)

# create contarct, wich updated record in created table
code, name = utils.generate_name_and_code("")
name = "updateTab_" name
ins = "DBUpdate(\"" tableName "\", 1, \"MyName\" ,\"update\" )"
body = """ { \n data {} \n conditions {} \n action { \n """ ins """ \n } }"""
code = "contract " name " " body
data = {"Value": code, "ApplicationId": 1,
"Conditions": "true"}
res = self.call("NewContract", data)
print("Create new update contract block = " res)
self.assertGreater(int(res), 0, "BlockId is not generated: " res)

# call contarct, wich added record in created table
res = self.call(name, data)
print("Added update = " res)
self.assertGreater(int(res), 0, "BlockId is not generated: " res)

# added 2 blocks
data = {"Name": "max_block_user_tx", "Value": "2"}
res = self.call("UpdateSysParam", data)
self.assertGreater(int(res), 0, "BlockId is not generated: " res)

data = {"Name": "max_block_user_tx", "Value": "2"}
res = self.call("UpdateSysParam", data)
self.assertGreater(int(res), 0, "BlockId is not generated: " res)
print("Finally block = " res)

Зарегистрируйтесь на ontext.info для получения дополнительных возможностей по работе с сервисом.