def test_key_parsing(self):
        store = MemoryPersist()
        mykey = ('1', '2', '3')

        key = store.key(*mykey)
        keyparts = store.key_parts(key)

        nt.assert_equal(mykey, keyparts)
예제 #2
0
    def test_key_parsing(self):
        store = MemoryPersist()
        mykey = ('1', '2', '3')

        key = store.key(*mykey)
        keyparts = store.key_parts(key)

        nt.assert_equal(mykey, keyparts)
예제 #3
0
 def test_write_read_colq(self):
     store = MemoryPersist()
     store.write('test', value=1)
     store.write('test', 'colf', value=2)
     store.write('test', 'colf', 'colq', value=3)
     nt.assert_equal(1, store.read('test'))
     nt.assert_equal(2, store.read('test', 'colf'))
     nt.assert_equal(3, store.read('test', 'colf', 'colq'))
예제 #4
0
    def test_sign_serial_increment(self):
        ezbakeca.EzbakeCA.setup(store=MemoryPersist())
        ca = ezbakeca.EzbakeCA()

        # first cert
        pkey = ezbakeca.private_key()
        req = ezbakeca.csr(pkey,
                           CN="App",
                           O="Ezbake",
                           OU="Ezbake Apps",
                           C="US")
        cert = ca.sign_csr(req)
        nt.assert_equal(cert.get_subject(), req.get_subject())
        nt.assert_equal(cert.get_serial_number(), 2)

        # second cert
        pkey = ezbakeca.private_key()
        req = ezbakeca.csr(pkey,
                           CN="App2",
                           O="Ezbake",
                           OU="Ezbake Apps",
                           C="US")
        cert = ca.sign_csr(req)
        nt.assert_equal(cert.get_subject(), req.get_subject())
        nt.assert_equal(cert.get_serial_number(), 3)
예제 #5
0
def ezpersist_instance(mode):
    if mode == "file":
        store = FilePersist(EzCAHandler.TABLE_NAME)
    elif mode == "accumulo":
        raise NotImplementedError("accumulo persistance not supported by EzCA yet")
    else:
        store = MemoryPersist()
    return store
 def test_table_delete_doesnt_affect_other(self):
     store = MemoryPersist(["table1", "table2"])
     store.write("test", "colf", "colq", "table1", 12345)
     store.write("test", "colf", "colq", "table2", 12345)
     store.delete("test", "table1")
     nt.assert_equal(12345, store.read("test", "colf", "colq", "table2"))
     nt.assert_raises(KeyError, store.read, ('test', 'table1'))
예제 #7
0
 def test_table_delete_doesnt_affect_other(self):
     store = MemoryPersist(["table1", "table2"])
     store.write("test", "colf", "colq", "table1", 12345)
     store.write("test", "colf", "colq", "table2", 12345)
     store.delete("test", "table1")
     nt.assert_equal(12345, store.read("test", "colf", "colq", "table2"))
     nt.assert_raises(KeyError, store.read, ('test', 'table1'))
예제 #8
0
    def __init__(self, ca_name, ezconfig=EzConfiguration().getProperties()):
        mode = ezconfig.get(EzCAHandler.PERSIST_MODE, "file")
        if mode == "file":
            store = FilePersist(EzCAHandler.TABLE_NAME)
        elif mode == "accumulo":
            raise NotImplementedError("accumulo persistance not supported by EzCA yet")
        else:
            store = MemoryPersist()
        EzbakeCA.setup(store=store)
        Cert.setup(store=store)

        self.store = store
        try:
            logger.info("Reading CA certificate {}".format(ca_name))
            self.ca = EzbakeCA.get_named(ca_name)
        except KeyError:
            self.ca = EzbakeCA(name=ca_name)
        self.ca.save()
예제 #9
0
 def test_all(self):
     store = MemoryPersist(["default", "test2table"])
     store.write('test', value=1)
     store.write('test', 'colf', value=2)
     store.write('test', 'colf', 'colq', value=3)
     store.write('test2', table="test2table", value=1)
     store.write('test2', 'colf2', table="test2table", value=2)
     store.write('test2', 'colf2', 'colq2', table="test2table", value=3)
예제 #10
0
 def test_key_underscore(self):
     store = MemoryPersist()
     okey = ("TEST", "test_test", "test")
     key = store.key(okey)
     parts = store.key_parts(key)
예제 #11
0
 def test_table_name(self):
     store = MemoryPersist("table1")
     store.write("test", "colf", "colq", "table1", 12345)
     nt.assert_equal(12345, store.read("test", "colf", "colq", "table1"))
 def test_write_read(self):
     store = MemoryPersist()
     store.write('test', value=1)
     nt.assert_equal(1, store.read('test'))
 def test_write_read_colq(self):
     store = MemoryPersist()
     store.write('test', value=1)
     store.write('test', 'colf', value=2)
     store.write('test', 'colf', 'colq', value=3)
     nt.assert_equal(1, store.read('test'))
     nt.assert_equal(2, store.read('test', 'colf'))
     nt.assert_equal(3, store.read('test', 'colf', 'colq'))
예제 #14
0
 def test_write_read_delete(self):
     store = MemoryPersist()
     store.write('test', value=1)
     nt.assert_equal(1, store.read('test'))
     store.delete('test')
     nt.assert_raises(KeyError, store.read, ('test',))
예제 #15
0
 def test_write_read(self):
     store = MemoryPersist()
     store.write('test', value=1)
     nt.assert_equal(1, store.read('test'))
 def test_write_read_delete(self):
     store = MemoryPersist()
     store.write('test', value=1)
     nt.assert_equal(1, store.read('test'))
     store.delete('test')
     nt.assert_raises(KeyError, store.read, ('test', ))
 def test_table_name(self):
     store = MemoryPersist("table1")
     store.write("test", "colf", "colq", "table1", 12345)
     nt.assert_equal(12345, store.read("test", "colf", "colq", "table1"))
예제 #18
0
 def setUp(self):
     ezbakeca.EzbakeCA.setup(MemoryPersist())
 def test_all(self):
     store = MemoryPersist(["default", "test2table"])
     store.write('test', value=1)
     store.write('test', 'colf', value=2)
     store.write('test', 'colf', 'colq', value=3)
     store.write('test2', table="test2table", value=1)
     store.write('test2', 'colf2', table="test2table", value=2)
     store.write('test2', 'colf2', 'colq2', table="test2table", value=3)
 def setUp(self):
     Cert.setup(MemoryPersist())
 def test_key_underscore(self):
     store = MemoryPersist()
     okey = ("TEST", "test_test", "test")
     key = store.key(okey)
     parts = store.key_parts(key)