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"
示例#2
0
 def approve_js(self):
     user_to_approve = self.parser.target_user
     potential_widget = self.args[0]
     print(f"Attempting to Approve Potential Widget: {potential_widget}")
     return UserCode.approve(user_to_approve, potential_widget)