Ejemplo n.º 1
0
    def test_owned_by(self):
        UserCode(
            user="******",
            code_link="https://gitlab.com/real_url/raw/bubbles.js",
            code_type="js",
            approved=False,
        ).save()

        assert UserCode.owned_by("eno") == ["bubbles.js"]
Ejemplo n.º 2
0
    def test_extracing_name_from_url(self):
        UserCode(
            user="******", code_link="https://gitlab.com/real_url/raw", code_type="js",
        ).save()

        last = UserCode.last()
        assert last["approved"] == False
        assert last["name"] == "eno"
        assert last["owners"] == []

        assert UserCode.owned_by("eno") == ["eno.js"]
Ejemplo n.º 3
0
    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"]