Esempio n. 1
0
def dummy(request):
    pt_user_database = get_pt_user_database(request.wordpress_user)
    credentials = Credentials(
        driver='mysql',
        host=pt_user_database.host,
        port=pt_user_database.port,
        user=pt_user_database.user,
        password=pt_user_database.password,
        name=pt_user_database.name
    )
    database = Database(credentials.generate_sqla_url())

    session = database.new_session()

    application = session.query(Application).filter_by(id='pasteque').one()
    response = "<p>name: %s</p>" % application.name
    response += "<p>version: %s</p>" % application.version

    for loc in session.query(CashRegister).all():
        response += "<p>%s</p>" % str(loc.location.name)

    # response += "<p>Database = %s</p>" % database
    # response = "<p>Credentials = %s</p>" % credentials

    return HttpResponse(response)
Esempio n. 2
0
 def test_get_pt_user_database(self):
     wp_user = WpUsers.objects.using('wordpress').get(id=3)
     self.assertIsNotNone(wp_user)
     pt_user = get_pt_user_database(wp_user)
     self.assertIsNotNone(wp_user)
     self.assertEqual(pt_user.user, 'poutine')
Esempio n. 3
0
 def test_get_pt_user_database(self):
     wp_user = WpUsers.objects.using('wordpress').get(id=3)
     self.assertIsNotNone(wp_user)
     pt_user = get_pt_user_database(wp_user)
     self.assertIsNotNone(wp_user)
     self.assertEqual(pt_user.user, 'poutine')