Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions fixtures/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -905,5 +905,37 @@
"code": "ArrayToSource(dat, [\"hello\", \"my name\",\"is Billy\"])",
"menu": "default_menu",
"content": {}
},
"datetime": {
"code": "DateTime(\"2018-07-23 05:54:10\", \"HH:MI:SS DD.MM.YYYY\")",
"menu": "default_menu",
"content": {
"tag": "text",
"text": "05:54:10 23.07.2018"
}
},
"datetimeUnix": {
"code": "DateTime(\"1532325250\", \"HH:MI:SS DD.MM.YYYY\")",
"menu": "default_menu",
"content": {
"tag": "text",
"text": "05:54:10 23.07.2018"
}
},
"cmpTime": {
"code": "SetVar(d, \"1532325250\") CmpTime(\"1532325250\", \"#d#\")",
"menu": "default_menu",
"content": {
"tag": "text",
"text": "0"
}
},
"cmpTimeUnix": {
"code": "SetVar(d, \"05:54:10 23.07.2018\") CmpTime(\"#d#\", \"05:54:10 23.07.2018\")",
"menu": "default_menu",
"content": {
"tag": "text",
"text": "0"
}
}
}
22 changes: 22 additions & 0 deletions fixtures/simvolio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1098,3 +1098,25 @@ UpdateRolesNotifications:
}
}
asert: "True"


datetime:
code: |
{
data {}
action {
$result = DateTime(1532325250)
}
}
asert: "2018-07-23 05:54:10"


unixdatetime:
code: |
{
data {}
action {
$result = UnixDateTime("2018-07-23 05:54:10")
}
}
asert: "1532325250"
50 changes: 50 additions & 0 deletions test_protypo.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,3 +1037,53 @@ def test_transactionInfo(self):
expected_str = '"contract":"@1NewContract","params":{"ApplicationId":1'
self.uni.assertIn(expected_str, str(part_content),
'transactionInfo has problem: ' + str(content['tree']))

def test_page_datetime(self):
cont = self.pages['datetime']
content = self.check_page(cont['code'])
part_content = content['tree'][0]
contract_content = cont['content']
must_be = dict(tag=part_content['tag'],
text=part_content['text'])
page = dict(tag=contract_content['tag'],
text=contract_content['text'])
self.uni.assertDictEqual(must_be, page,
'datetime has problem: ' + str(content['tree']))

def test_page_datetimeUnix(self):
# returns datetime in timezone in which the node is running
cont = self.pages['datetimeUnix']
content = self.check_page(cont['code'])
part_content = content['tree'][0]
contract_content = cont['content']
must_be = dict(tag=part_content['tag'],
text=part_content['text'])
page = dict(tag=contract_content['tag'],
text=contract_content['text'])
self.uni.assertDictEqual(must_be, page,
'datetimeUnix has problem: ' + str(content['tree']))

def test_page_cmpTime(self):
cont = self.pages['cmpTime']
content = self.check_page(cont['code'])
part_content = content['tree'][0]
contract_content = cont['content']
must_be = dict(tag=part_content['tag'],
text=part_content['text'])
page = dict(tag=contract_content['tag'],
text=contract_content['text'])
self.uni.assertDictEqual(must_be, page,
'cmpTime has problem: ' + str(content['tree']))

def test_page_cmpTimeUnix(self):
cont = self.pages['cmpTimeUnix']
content = self.check_page(cont['code'])
part_content = content['tree'][0]
contract_content = cont['content']
must_be = dict(tag=part_content['tag'],
text=part_content['text'])
page = dict(tag=contract_content['tag'],
text=contract_content['text'])
self.uni.assertDictEqual(must_be, page,
'cmpTimeUnix has problem: ' + str(content['tree']))

9 changes: 9 additions & 0 deletions test_simvolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,3 +698,12 @@ def test_contract_UpdateNotifications(self):
def test_contract_UpdateRolesNotifications(self):
contract = self.contracts['UpdateRolesNotifications']
self.check_contract(contract['code'], contract['asert'])

def test_contract_datetime(self):
# returns datetime in timezone in which the node is running
contract = self.contracts['datetime']
self.check_contract(contract['code'], contract['asert'])

def test_contract_unixdatetime(self):
contract = self.contracts['unixdatetime']
self.check_contract(contract['code'], contract['asert'])