def test_updating_js(self): user = "******" result = UserCodeRouter( user, "js", ["https://gist.githubusercontent.com/davidbegin/raw/beginfun.js"], ).route() assert UserCode.count() == 1 UserCode.approve(user, "beginfun") user_code = UserCode.last() assert user_code["approved"] == True result = UserCodeRouter( user, "js", [ "https://gist.githubusercontent.com/davidbegin/raw/234232342/beginfun.js" ], ).route() assert UserCode.count() == 1 user_code = UserCode.last() assert user_code["user"] == "beginbotbot" assert user_code["approved"] == True assert ( user_code["code_link"] == "https://gist.githubusercontent.com/davidbegin/raw/234232342/beginfun.js" ) assert user_code["code_type"] == "js"
def test_user_code(self): assert UserCode.count() == 0 UserCode( user="******", code_link="https://gitlab.com/real_url/beginwidget.js", code_type="js", approved=True, ).save() last = UserCode.last() assert last["approved"] == True assert last["name"] == "beginwidget" assert last["owners"] == [] assert UserCode.owned_by("eno") == ["beginwidget.js"] assert UserCode.find_owners("beginwidget") == [ "eno", ] result = UserCode.purchase("begin", "beginwidget") assert UserCode.find_owners("beginwidget") == ["eno", "begin"] assert UserCode.owned_by("begin") == ["beginwidget.js"]