# Generated by the windmill services transformer
from windmill.authoring import WindmillTestClient

def test_AddRootCA():
    client = WindmillTestClient(__name__)

    client.open(url=u'http://127.0.0.1:8000/admin/')
    client.waits.forPageLoad(timeout=u'8000')
    client.type(text=u'admin', id=u'id_username')
    client.type(text=u'admin', id=u'id_password')
    client.click(value=u'Log in')
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(xpath=u"//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a", timeout=u'8000')
    client.click(xpath=u"//div[@id='content-main']/div[2]/table/tbody/tr[1]/td[1]/a")
    client.waits.forPageLoad(timeout=u'20000')
    client.waits.forElement(timeout=u'8000', id=u'id_description')
    client.click(id=u'id_description')
    client.type(text=u'Windmill RootCA', id=u'id_description')
    client.click(id=u'id_common_name')
    client.type(text=u'Root CA', id=u'id_common_name')
    client.click(id=u'id_state')
    client.type(text=u'Bavaria', id=u'id_state')
    client.type(text=u'Munich', id=u'id_locality')
    client.click(id=u'id_organization')
    client.type(text=u'My Company', id=u'id_organization')
    client.click(id=u'id_email')
    client.type(text=u'daniel@linuxaddicted.de', id=u'id_email')
    client.click(id=u'id_valid_days')
    client.type(text=u'365', id=u'id_valid_days')
    client.click(id=u'id_passphrase')
    client.type(text=u'1234567890', id=u'id_passphrase')
    client.check(id=u'id_der_encoded')
    client.check(id=u'id_subcas_allowed')
    client.click(xpath=u"//form[@id='certificateauthority_form']/div[2]/div[2]/input[1]")
    client.waits.forPageLoad(timeout=u'20000')
    client.asserts.assertTextIn(xpath=u"//div[@id='container']/ul/li", validator=u'The certificate authority "Root_CA" was added successfully.')

