Ejemplo n.º 1
0
def test__invert_and_aggregate():
    """
    Check that the transform works as expected.
    """
    input = {u'Olinger Account:Mark Olinger': u"Editor's Circle"}
    expected = {
            u"Editor's Circle":
            [u'Olinger Account:Mark Olinger']
            }
    actual = _invert_and_aggregate(input)
    assert expected == actual
Ejemplo n.º 2
0
def generate_circle_data():
    """
    Create a JSON file based on current circle members that
    identifies the level of circle membership. Save this
    file to S3.
    """

    # circle wall
    sf = SalesforceConnection()
    response = sf.query(circle_query)
    new_dict = _extract_and_map(argument=response,
            key='Text_For_Donor_Wall__c',
            value='Membership_Level_TT__c',
            sort_key='Name')
    intermediate = _invert_and_aggregate(new_dict)
    now_sorted = _sort_circle(intermediate)
    final = _strip_sort_key(now_sorted)
    json_output = json.dumps(final)

    push_to_s3(filename='circle-members.json', contents=json_output)