def test_add(self):
     with vcr.use_cassette("fixtures/ac.cnstrc.com/add-success.yaml"):
         constructor = ConstructorIO(**HTTPS_ARGS)
         resp = constructor.add(
             item_name="boinkamoinka",
             autocomplete_section="Search Suggestions"
         )
         assert resp is True
 def test_add(self):
     with vcr.use_cassette("fixtures/ac.cnstrc.com/add-success.yaml"):
         constructor = ConstructorIO(api_token="apiToken",
                                     autocomplete_key="autocompleteKey",
                                     protocol="http",
                                     host="ac.cnstrc.com")
         resp = constructor.add(item_name="boinkamoinka",
                                autocomplete_section="Search Suggestions")
         assert resp == True
예제 #3
0
 def test_add_remove_metadata(self):
     with my_vcr.use_cassette(
             "fixtures/ac.cnstrc.com/add-metadata-success.yaml"):
         constructor = ConstructorIO(**HTTPS_ARGS)
         resp = constructor.add(item_name="Metadata Example",
                                autocomplete_section="Products",
                                url="https://metadata.example",
                                metadata={"this_key": "this_value"})
         assert resp is True
         resp = constructor.remove(item_name="Metadata Example",
                                   autocomplete_section="Products")
         assert resp is True
 def test_add(self):
     with vcr.use_cassette("fixtures/ac.cnstrc.com/add-success.yaml"):
         constructor = ConstructorIO(
             api_token = "apiToken",
             autocomplete_key = "autocompleteKey",
             protocol = "http",
             host = "ac.cnstrc.com"
         )
         resp = constructor.add(
             item_name = "boinkamoinka",
             autocomplete_section = "Search Suggestions"
         )
         assert resp == True
예제 #5
0
    def test_modify(self):
        with my_vcr.use_cassette("fixtures/ac.cnstrc.com/modify-success.yaml"):
            constructor = ConstructorIO(**HTTPS_ARGS)
            resp = constructor.add(item_name="Stanley_Steamer",
                                   autocomplete_section="Search Suggestions")
            assert resp is True

            resp = constructor.modify(
                item_name="Stanley_Steamer",
                new_item_name="Newer_Stanley_Steamer",
                suggested_score=100,
                autocomplete_section="Search Suggestions")
            assert resp is True
            # clean things up so that when we re-run the test we don't
            # get an error when we add it
            resp = constructor.remove(
                item_name="Newer_Stanley_Steamer",
                autocomplete_section="Search Suggestions")
            assert resp is True
예제 #6
0
    api_token = raw_input("enter api token (enter q to quit) : ")
    if api_token == "q":
        print "toodles!"
        sys.exit(0)
    autocomplete_key = raw_input("enter autocomplete key (enter q to quit) : ")
    if autocomplete_key == "q":
        print "toodles!"
        sys.exit(0)
    autocomplete_section = raw_input(
        "enter autocomplete section (enter q to quit) : ")
    if autocomplete_section == "q":
        print "toodles!"
        sys.exit(0)
    constructor = ConstructorIO(api_token=api_token,
                                autocomplete_key=autocomplete_key)
    with open("example.csv") as csv_file:
        example_csv = csv.DictReader(csv_file)
        for row in example_csv:
            print "row: ", row
            print "sending this row over to your Constructor.io account..."
            constructor.add(row["term"],
                            autocomplete_section,
                            score=row["score"])
    print "let's go see the terms you added!"
    webbrowser_resp = raw_input("Go to constructor.io right now? (y/n) (n)")
    if webbrowser_resp == "y":
        print "ok! let's go!"
        webbrowser.open("http://constructor.io/dashboard")
    else:
        print "ok, then just go to constructor.io/dashboard some other time"
예제 #7
0
 def test_add(self):
     with my_vcr.use_cassette("fixtures/ac.cnstrc.com/add-success.yaml"):
         constructor = ConstructorIO(**HTTPS_ARGS)
         resp = constructor.add(item_name="boinkamoinka",
                                autocomplete_section="Search Suggestions")
         assert resp is True
예제 #8
0
if __name__ == "__main__":
    api_token = raw_input("enter api token (enter q to quit) : ")
    if api_token == "q":
        print "toodles!"
        sys.exit(0)
    autocomplete_key = raw_input("enter autocomplete key (enter q to quit) : ")
    if autocomplete_key == "q":
        print "toodles!"
        sys.exit(0)
    autocomplete_section = raw_input("enter autocomplete section (enter q to quit) : ")
    if autocomplete_section == "q":
        print "toodles!"
        sys.exit(0)
    constructor = ConstructorIO(api_token, autocomplete_key) # is that right?
    with open("example.csv") as csv_file:
        example_csv = csv.DictReader(csv_file)
        for row in example_csv:
            print "row: ", row
            print "sending this row over to your Constructor.io account..."
            constructor.add(row["term"],
                            autocomplete_section,
                            score=row["score"])
    print "let's go see the terms you added!"
    webbrowser_resp = raw_input("Go to constructor.io right now? (y/n) (n)")
    if webbrowser_resp == "y":
        print "ok! let's go!"
        webbrowser.open("http://constructor.io/dashboard")
    else:
        print "ok, then just go to constructor.io/dashboard some other time"