Esempio n. 1
0
 def test_ohloh_gives_us_an_icon(self):
     oh = ohloh.get_ohloh()
     icon = oh.get_icon_for_project('f-spot')
     icon_fd = StringIO(icon)
     from PIL import Image
     image = Image.open(icon_fd)
     self.assertEqual(image.size, (64, 64))
Esempio n. 2
0
 def testProjectDataById(self):
     # {{{
     oh = ohloh.get_ohloh()
     data = oh.project_id2projectdata(15329)
     self.assertEqual('ccHost', data['name'])
     self.assertEqual('http://wiki.creativecommons.org/CcHost',
                      data['homepage_url'])
Esempio n. 3
0
 def testFindByEmail(self): 
     # {{{
     oh = ohloh.get_ohloh()
     projects = oh.get_contribution_info_by_email('*****@*****.**')
     assert {'project': u'playerpiano',
             'project_homepage_url': 'http://code.google.com/p/playerpiano',
             'man_months': 1,
             'primary_language': 'Python'} in projects
Esempio n. 4
0
 def testFindContributionsInOhlohAccountByUsername(self):
     # {{{
     oh = ohloh.get_ohloh()
     projects, web_response = oh.get_contribution_info_by_ohloh_username('paulproteus')
     
     assert {'project': u'ccHost',
             'project_homepage_url': 'http://wiki.creativecommons.org/CcHost',
             'man_months': 1,
             'primary_language': 'shell script'} in projects
Esempio n. 5
0
 def test_find_debian(self):
     self.assertNotEqual("debian", "ubuntu", "This is an assumption of this test.")
     oh = ohloh.get_ohloh()
     project_data = oh.project_name2projectdata("Debian GNU/Linux")
     self.assertEqual(
         project_data["name"],
         "Debian GNU/Linux",
         "Expected that when we ask Ohloh, what project is called 'Debian GNU/Linux', Ohloh gives a project named 'Debian GNU/Linux', not, for example, 'Ubuntu'.",
     )
Esempio n. 6
0
 def testFindContributionsInOhlohAccountByEmail(self):
     oh = ohloh.get_ohloh()
     username = oh.email_address_to_ohloh_username('*****@*****.**')
     projects, web_response = oh.get_contribution_info_by_ohloh_username(username)
     
     assert {'project': u'ccHost',
             'project_homepage_url': 'http://wiki.creativecommons.org/CcHost',
             'man_months': 1,
             'primary_language': 'shell script'} in projects
Esempio n. 7
0
 def testFindByOhlohUsername(self, should_have = None):
     # {{{
     oh = ohloh.get_ohloh()
     projects, web_response = oh.get_contribution_info_by_ohloh_username('paulproteus')
     if should_have is None:
         should_have = [{'project': u'ccHost',
                          'project_homepage_url': 'http://wiki.creativecommons.org/CcHost',
                          'man_months': 1,
                          'primary_language': 'shell script'}]
     self.assertEqual(should_have, projects)
Esempio n. 8
0
 def testFindByEmail(self):
     # {{{
     oh = ohloh.get_ohloh()
     projects = oh.get_contribution_info_by_email("*****@*****.**")
     assert {
         "project": u"playerpiano",
         "project_homepage_url": "http://code.google.com/p/playerpiano",
         "man_months": 1,
         "primary_language": "Python",
     } in projects
Esempio n. 9
0
    def testFindContributionsInOhlohAccountByEmail(self):
        oh = ohloh.get_ohloh()
        username = oh.email_address_to_ohloh_username("*****@*****.**")
        projects, web_response = oh.get_contribution_info_by_ohloh_username(username)

        assert {
            "project": u"ccHost",
            "project_homepage_url": "http://wiki.creativecommons.org/CcHost",
            "man_months": 1,
            "primary_language": "shell script",
        } in projects
Esempio n. 10
0
    def testFindContributionsInOhlohAccountByUsername(self):
        # {{{
        oh = ohloh.get_ohloh()
        projects, web_response = oh.get_contribution_info_by_ohloh_username("paulproteus")

        assert {
            "project": u"ccHost",
            "project_homepage_url": "http://wiki.creativecommons.org/CcHost",
            "man_months": 1,
            "primary_language": "shell script",
        } in projects
Esempio n. 11
0
 def testFindByOhlohUsername(self, should_have=None):
     # {{{
     oh = ohloh.get_ohloh()
     projects, web_response = oh.get_contribution_info_by_ohloh_username("paulproteus")
     if should_have is None:
         should_have = [
             {
                 "project": u"ccHost",
                 "project_homepage_url": "http://wiki.creativecommons.org/CcHost",
                 "man_months": 1,
                 "primary_language": "shell script",
             }
         ]
     self.assertEqual(should_have, projects)
Esempio n. 12
0
    def testFindByUsername(self, do_contents_check=True):
        # {{{
        oh = ohloh.get_ohloh()
        projects, web_response = oh.get_contribution_info_by_username('paulproteus')
        # We test the web_response elsewhere
        should_have = {'project': u'ccHost',
                       'project_homepage_url': 'http://wiki.creativecommons.org/CcHost',
                       'man_months': 1,
                       'primary_language': 'shell script'}

        if do_contents_check:
            self.assert_(should_have in projects)

        return projects
Esempio n. 13
0
    def testFindByUsername(self, do_contents_check=True):
        # {{{
        oh = ohloh.get_ohloh()
        projects, web_response = oh.get_contribution_info_by_username("paulproteus")
        # We test the web_response elsewhere
        should_have = {
            "project": u"ccHost",
            "project_homepage_url": "http://wiki.creativecommons.org/CcHost",
            "man_months": 1,
            "primary_language": "shell script",
        }

        if do_contents_check:
            self.assert_(should_have in projects)

        return projects
Esempio n. 14
0
 def testProjectNameByAnalysisId(self):
     # {{{
     oh = ohloh.get_ohloh()
     project_name = 'ccHost'
     analysis_id = oh.get_latest_project_analysis_id(project_name);
     self.assertEqual(project_name, oh.analysis2projectdata(analysis_id)['name'])
Esempio n. 15
0
 def test_ohloh_errors_correctly_even_when_we_send_her_spaces(self):
     oh = ohloh.get_ohloh()
     self.assertRaises(ValueError, oh.get_icon_for_project,
             'surely nothing is called this name')
Esempio n. 16
0
 def testProjectDataById(self):
     # {{{
     oh = ohloh.get_ohloh()
     data = oh.project_id2projectdata(15329)
     self.assertEqual("ccHost", data["name"])
     self.assertEqual("http://wiki.creativecommons.org/CcHost", data["homepage_url"])
Esempio n. 17
0
 def test_ohloh_errors_on_project_lacking_icon(self):
     oh = ohloh.get_ohloh()
     self.assertRaises(ValueError, oh.get_icon_for_project, 'asdf')
Esempio n. 18
0
 def test_ohloh_errors_on_nonexistent_project(self):
     oh = ohloh.get_ohloh()
     self.assertRaises(ValueError, oh.get_icon_for_project, 'lolnomatxh')
Esempio n. 19
0
 def testFindUsernameByEmail(self):
     # {{{
     oh = ohloh.get_ohloh()
     username = oh.email_address_to_ohloh_username('*****@*****.**')
     self.assertEquals(username, 'paulproteus')
Esempio n. 20
0
 def test_find_empty_project_without_errors(self):
     oh = ohloh.get_ohloh()
     project_data = oh.project_name2projectdata("theres no PROJECT quite LIKE THIS ONE two pound curry irrelevant keywords watch me fail please if not god help us")
     self.assertEqual(project_data, None, "We successfully return None when the project is not found.")
Esempio n. 21
0
 def testFindByUsernameNotAsheesh(self):
     # {{{
     oh = ohloh.get_ohloh()
     projects, web_response = oh.get_contribution_info_by_username('keescook')
     self.assert_(len(projects) > 1)