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"]
def buy_js(self): # user_to_approve = self.parser.target_user potential_widget = self.args[0] return UserCode.purchase(self.user, potential_widget)