def test_factory_gist(features): contents = json.dumps(features) size = len(contents) with mock.patch.object(github3.GitHub, 'create_gist') as MockInstance: class Dummy(object): id = 'abc123' MockInstance.return_value = Dummy() url = geojsonio.make_url(contents, size_for_gist=size-1) assert url == geojsonio.gist_url(Dummy.id)
def test_gist_url(): expected = "http://geojson.io/#id=gist:/abcd" assert expected == geojsonio.gist_url('abcd')