示例#1
0
def test_lazy_dict():

    o = LazyDict(a=1, b=2)

    ostr = pickle.dumps(o, pickle.HIGHEST_PROTOCOL)
    o = pickle.loads(ostr)

    assert o.a == 1
    assert o.b == 2
    o.c = 3
    assert o.c == 3, o.c
    assert o['c'] == 3
    try:
        o.d
        assert False
    except AttributeError:
        pass

    del o.c
    assert not hasattr(o, 'c')
示例#2
0
    def test_create_superuser_mock(self, m_cli_create_user):
        """ We mock in this test to more accurately test the URL creation. """
        user = LazyDict(id=3, _token_plain='1234')
        m_cli_create_user.return_value = user

        result = self.invoke('auth', 'create-user', '--as-superuser',
                             '*****@*****.**')

        assert 'User created.\nEmail sent with verification URL.' in result.output
        assert 'Verification URL: http://keg.example.com/verify-account/3/1234' in result.output

        m_cli_create_user.assert_called_once_with(email='*****@*****.**',
                                                  extra_args=(),
                                                  is_superuser=True,
                                                  mail_enabled=True)
示例#3
0
 def __init__(self):
     self._x = True
     LazyDict.__init__(self)
示例#4
0
 def init(self):
     self.styles_cache = LazyDict()
     self._xlsx_format_cache = {}
     self.default_style = {}
     self.col_widths = {}