def test_02_put(self): ns = self.mkns(put=[u'example.net', u'dummy']) perform(ns) ns = self.mkns(get=u'example.net') perform(ns) dbfile = bsddb3.hashopen(dbname, 'c', 0o600) assert b'example.net' in dbfile assertEqual(dbfile[b'example.net'], b'dummy') dbfile.close()
def test_05_unload(self): expected = [b'example.net', b'example.ch'] self.stub_stdout(ioclass=io.StringIO) ns = self.mkns(unload=True) perform(ns) v = sys.stdout.getvalue() for line in v.split('\n'): if line != '': (k, delim, v) = line.partition('\t') expected.remove(utf8(k)) assertEqual(expected, [])
def test_01_load(self): self.stub_stdin( u'example.ch\tXmplScrt\thttps://example.ch/index.php/apps/ojsxc/ajax/externalApi.php\texample.ch\t\n' + u'example.de\tNothrXampl\thttps://nothing\t\n') ns = self.mkns(load=True) perform(ns) assertEqual( domfile[b'example.ch'], b'XmplScrt\thttps://example.ch/index.php/apps/ojsxc/ajax/externalApi.php\texample.ch\t' ) assertEqual(domfile[b'example.de'], b'NothrXampl\thttps://nothing\t') assert b'example.net' not in domfile
#!/usr/bin/python -tt from xclib.configuration import get_args from xclib.dbmops import perform DESC = '''XMPP server authentication against JSXC>=3.2.0 on Nextcloud: Database manipulation. See https://jsxc.org or https://github.com/jsxc/xmpp-cloud-auth.''' EPILOG = '''Exactly one of -G, -P, -D, -L, and -U is required.''' if __name__ == '__main__': args = get_args(None, DESC, EPILOG, 'xcdbm') perform(args) # vim: tabstop=8 softtabstop=0 expandtab shiftwidth=4
def test_04_delete(self): ns = self.mkns(delete=u'example.de') perform(ns)
def test_03_get(self): self.stub_stdout(ioclass=io.StringIO) ns = self.mkns(get=u'example.net') perform(ns) self.assertEqual(sys.stdout.getvalue(), u'dummy\n')