Announcing mockfacebook

Recently, while researching a side project, I started looking at the Facebook APIs. I was surprised that I couldn’t find a decent library for mocking or faking FQL or the Graph API. Everyone just uses live Facebook to test, sometimes even in unit tests!

A few thousand lines of code later, I had a little utility to fill that void. mockfacebook is a standalone HTTP server that implements Facebook’s FQL and Graph API. It’s particularly useful for automated integration testing. It’s backed by a SQLite database, which you can seed from Facebook or populate manually or programmatically.

Feedback is welcome!


9 thoughts on “Announcing mockfacebook

  1. I’m having trouble installing Mockfacebook, where can I find a guide?

  2. I’m following the guide from the githup repo, and when I execute download.py with my access token I get this errors:

    WARNING:root:webapp2_extras.local is not available so webapp2 won’t be thread-safe!
    Generating FQL example data….
    Wrote FqlDataset to /home/ricardo/Desktop/mockfacebook/fql_data.py.
    Traceback (most recent call last):
    File “./download.py”, line 707, in
    File “./download.py”, line 696, in main
    File “/home/ricardo/Desktop/mockfacebook/schemautil.py”, line 117, in write
    sql = self.to_sql()
    File “/home/ricardo/Desktop/mockfacebook/schemautil.py”, line 342, in to_sql
    values_str = self.schema.json_to_sqlite(object, table)
    File “/home/ricardo/Desktop/mockfacebook/schemautil.py”, line 213, in json_to_sqlite
    val = object.get(col.name, ”)
    AttributeError: ‘unicode’ object has no attribute ‘get’

  3. apologies for the delay. i’ve checked in a few bug fixes. mind trying again?

    btw, i’ve also changed it to not download FQL data by default, since FB’s FQL docs (which mockfacebook uses to generate its schema) are hopelessly out of date. if you want FQL data, pass –fql_data to download.py, but be warned, it may not work.

  4. also, to be honest, i’m not maintaining mockfacebook very aggressively right now, so bug fixes and other updates may be slow.

  5. Thank you very much Ryan, I can successfully run the app, I’ll try to use it with the Koala gem for Rails

Leave a Reply

Your email address will not be published. Required fields are marked *