Fix unit tests
This commit is contained in:
parent
fc4366c028
commit
913aac26ca
@ -1,5 +1,5 @@
|
||||
# Eos - Verifiable elections
|
||||
# Copyright © 2017-18 RunasSudo (Yingtong Li)
|
||||
# Copyright © 2017-2021 RunasSudo (Yingtong Li)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
@ -133,6 +133,7 @@ class TaskTestCase(EosTestCase):
|
||||
def setUpClass(cls):
|
||||
cls.db_connect_and_reset()
|
||||
|
||||
@py_only
|
||||
def test_normal(self):
|
||||
class TaskNormal(Task):
|
||||
result = StringField()
|
||||
@ -149,6 +150,7 @@ class TaskTestCase(EosTestCase):
|
||||
self.assertEqual(task.messages[0], 'Hello World')
|
||||
self.assertEqual(task.result, 'Success')
|
||||
|
||||
@py_only
|
||||
def test_error(self):
|
||||
class TaskError(Task):
|
||||
def _run(self):
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# Eos - Verifiable elections
|
||||
# Copyright © 2017 RunasSudo (Yingtong Li)
|
||||
# Copyright © 2017-2021 RunasSudo (Yingtong Li)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
@ -43,9 +43,9 @@ class BasePyTestCase(TestCase):
|
||||
class BaseJSTestCase(TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
with open('eos/__javascript__/eos.js_tests.js', 'r') as f:
|
||||
with open('eosweb/core/static/js/eosjs.js', 'r') as f:
|
||||
code = f.read()
|
||||
cls.ctx = execjs.get().compile('var window={},navigator={};' + code + 'var test=window.eosjs_tests.' + cls.module + '.__all__.' + cls.name + '();test.setUpClass();')
|
||||
cls.ctx = execjs.get().compile('var window={},navigator={};' + code + 'var eosjs=require("eosjs");var test=eosjs.' + cls.module + '.' + cls.name + '();test.setUpClass();')
|
||||
|
||||
@classmethod
|
||||
def add_method(cls, method):
|
||||
|
Loading…
Reference in New Issue
Block a user