예제 #1
0
    def test_contribute_too_large(self):
        self.reqs['resources'][
            '/contribute.json'] = '{"name": "' + 'foo' * 100000 + '"}'

        result = contribute(self.reqs)

        self.assertEquals(result['data'], {})
예제 #2
0
    def test_no_contribute_not_-(self):
        self.reqs['responses']['auto'].url = 'https://github.com'

        result = contribute(self.reqs)

        self.assertEquals('contribute-json-only-required-on---properties', result['result'])
        self.assertTrue(result['pass'])
예제 #3
0
    def test_invalid_json(self):
        self.reqs['resources']['/contribute.json'] = 'foobar'

        result = contribute(self.reqs)

        self.assertEquals('contribute-json-invalid-json', result['result'])
        self.assertFalse(result['pass'])
예제 #4
0
    def test_invalid_json(self):
        self.reqs['resources']['/contribute.json'] = 'foobar'

        result = contribute(self.reqs)

        self.assertEquals('contribute-json-invalid-json', result['result'])
        self.assertFalse(result['pass'])
예제 #5
0
    def test_no_contribute_not_mozilla(self):
        self.reqs['responses']['auto'].url = 'https://github.com'

        result = contribute(self.reqs)

        self.assertEquals('contribute-json-only-required-on-mozilla-properties', result['result'])
        self.assertTrue(result['pass'])
예제 #6
0
    def test_with_required_keys(self):
        self.reqs['resources']['/contribute.json'] = """
        {
            "name": "Bedrock",
            "description": "The app powering www.mozilla.org.",
            "repository": {
                "url": "https://github.com/mozilla/bedrock",
                "license": "MPL2",
                "tests": "https://travis-ci.org/mozilla/bedrock/"
            },
            "participate": {
                "home": "https://wiki.mozilla.org/Webdev/GetInvolved/mozilla.org",
                "docs": "http://bedrock.readthedocs.org/",
                "mailing-list": "https://www.mozilla.org/about/forums/#dev-mozilla-org",
                "irc": "irc://irc.mozilla.org/#www"
            },
            "bugs": {
                "list": "https://bugzilla.mozilla.org/describecomponents.cgi?product=www.mozilla.org",
                "report": "https://bugzilla.mozilla.org/enter_bug.cgi?product=www.mozilla.org",
                "mentored": "https://bugzilla.mozilla.org/buglist.cgi?f1=bug_mentor&o1=..."
            },
            "urls": {
                "prod": "https://www.mozilla.org",
                "stage": "https://www.allizom.org",
                "dev": "https://www-dev.allizom.org",
                "demo1": "https://www-demo1.allizom.org",
                "demo2": "https://www-demo2.allizom.org",
                "demo3": "https://www-demo3.allizom.org",
                "demo4": "https://www-demo4.allizom.org",
                "demo5": "https://www-demo5.allizom.org"
            },
            "keywords": [
                "python",
                "less-css",
                "django",
                "html5",
                "jquery"
            ]
        }"""

        result = contribute(self.reqs)

        self.assertEquals('contribute-json-with-required-keys',
                          result['result'])
        self.assertTrue(result['pass'])
예제 #7
0
    def test_with_required_keys(self):
        self.reqs['resources']['/contribute.json'] = """
        {
            "name": "Bedrock",
            "description": "The app powering www.mozilla.org.",
            "repository": {
                "url": "https://github.com/mozilla/bedrock",
                "license": "MPL2",
                "tests": "https://travis-ci.org/mozilla/bedrock/"
            },
            "participate": {
                "home": "https://wiki.mozilla.org/Webdev/GetInvolved/mozilla.org",
                "docs": "http://bedrock.readthedocs.org/",
                "mailing-list": "https://www.mozilla.org/about/forums/#dev-mozilla-org",
                "irc": "irc://irc.mozilla.org/#www"
            },
            "bugs": {
                "list": "https://bugzilla.mozilla.org/describecomponents.cgi?product=www.mozilla.org",
                "report": "https://bugzilla.mozilla.org/enter_bug.cgi?product=www.mozilla.org",
                "mentored": "https://bugzilla.mozilla.org/buglist.cgi?f1=bug_mentor&o1=..."
            },
            "urls": {
                "prod": "https://www.mozilla.org",
                "stage": "https://www.allizom.org",
                "dev": "https://www-dev.allizom.org",
                "demo1": "https://www-demo1.allizom.org",
                "demo2": "https://www-demo2.allizom.org",
                "demo3": "https://www-demo3.allizom.org",
                "demo4": "https://www-demo4.allizom.org",
                "demo5": "https://www-demo5.allizom.org"
            },
            "keywords": [
                "python",
                "less-css",
                "django",
                "html5",
                "jquery"
            ]
        }"""

        result = contribute(self.reqs)

        self.assertEquals('contribute-json-with-required-keys', result['result'])
        self.assertTrue(result['pass'])
예제 #8
0
    def test_missing_required_keys(self):
        self.reqs['resources']['/contribute.json'] = """
        {
            "name": "Bedrock",
            "description": "The app powering www.-.org.",
            "repository": {
                "url": "https://github.com/-/bedrock",
                "license": "MPL2",
                "tests": "https://travis-ci.org/-/bedrock/"
            },
            "participate": {
                "home": "https://wiki.-.org/Webdev/GetInvolved/-.org",
                "docs": "http://bedrock.readthedocs.org/",
                "mailing-list": "https://www.-.org/about/forums/#dev---org",
                "irc": "irc://irc.-.org/#www"
            },
            "urls": {
                "prod": "https://www.-.org",
                "stage": "https://www.allizom.org",
                "dev": "https://www-dev.allizom.org",
                "demo1": "https://www-demo1.allizom.org",
                "demo2": "https://www-demo2.allizom.org",
                "demo3": "https://www-demo3.allizom.org",
                "demo4": "https://www-demo4.allizom.org",
                "demo5": "https://www-demo5.allizom.org"
            },
            "keywords": [
                "python",
                "less-css",
                "django",
                "html5",
                "jquery"
            ]
        }"""

        result = contribute(self.reqs)

        self.assertEquals('contribute-json-missing-required-keys', result['result'])
        self.assertFalse(result['pass'])
예제 #9
0
    def test_no_contribute_mozilla(self):
        result = contribute(self.reqs)

        self.assertEquals('contribute-json-not-implemented', result['result'])
        self.assertFalse(result['pass'])
예제 #10
0
    def test_contribute_too_large(self):
        self.reqs['resources']['/contribute.json'] = '{"name": "' + 'foo' * 100000 + '"}'

        result = contribute(self.reqs)

        self.assertEquals(result['data'], {})
예제 #11
0
    def test_no_contribute_mozilla(self):
        result = contribute(self.reqs)

        self.assertEquals('contribute-json-not-implemented', result['result'])
        self.assertFalse(result['pass'])