Ejemplo n.º 1
0
        cls.m = Model()
        import pytest
        cls.pytest = pytest
    @classmethod
    def teardown_class(cls):
        cls.m.stop()
    def test_model_call(self):
        assert self.m.call('getblockhash', [1984]) == '00000000003535a16c585a76c25ce9201edd6bf4d52fbf05efa30d5971f23c67'
        assert 'version' in self.m.call('getinfo')
    def test_model_validate_address(self):
        assert self.m.validate_address('MwLm9TPCmk8JxwX8ysGGAp2nc4D8T5cKpW')
        assert not self.m.validate_address('asdf')
    def test_name_new_exists(self):
        with self.pytest.raises(NameDoesAlreadyExistError):
            self.m.name_new('d/namecoin')
    def test_parse_json(self):
        assert self.m.parse_json('asdf') == {}
        assert self.m.parse_json('{"a":1}') == {"a":1}

if __name__ == "__main__":
    import utest
    utest.run(__file__)

    if 0:
        model = Model()
        try:
            while 1:
                pass
        except:
            model.stop()
Ejemplo n.º 2
0
 def do_utest(self, line):
     """
         Unit Test
     """
     utest.run()