コード例 #1
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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))
コード例 #2
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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'])
コード例 #3
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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
コード例 #4
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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
コード例 #5
0
ファイル: tests.py プロジェクト: rafpaf/OpenHatch
 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'.",
     )
コード例 #6
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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
コード例 #7
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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)
コード例 #8
0
ファイル: tests.py プロジェクト: rafpaf/OpenHatch
 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
コード例 #9
0
ファイル: tests.py プロジェクト: rafpaf/OpenHatch
    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
コード例 #10
0
ファイル: tests.py プロジェクト: rafpaf/OpenHatch
    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
コード例 #11
0
ファイル: tests.py プロジェクト: rafpaf/OpenHatch
 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)
コード例 #12
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
    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
コード例 #13
0
ファイル: tests.py プロジェクト: rafpaf/OpenHatch
    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
コード例 #14
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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'])
コード例 #15
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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')
コード例 #16
0
ファイル: tests.py プロジェクト: rafpaf/OpenHatch
 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"])
コード例 #17
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 def test_ohloh_errors_on_project_lacking_icon(self):
     oh = ohloh.get_ohloh()
     self.assertRaises(ValueError, oh.get_icon_for_project, 'asdf')
コード例 #18
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 def test_ohloh_errors_on_nonexistent_project(self):
     oh = ohloh.get_ohloh()
     self.assertRaises(ValueError, oh.get_icon_for_project, 'lolnomatxh')
コード例 #19
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 def testFindUsernameByEmail(self):
     # {{{
     oh = ohloh.get_ohloh()
     username = oh.email_address_to_ohloh_username('*****@*****.**')
     self.assertEquals(username, 'paulproteus')
コード例 #20
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 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.")
コード例 #21
0
ファイル: tests.py プロジェクト: athonlab/OpenHatch
 def testFindByUsernameNotAsheesh(self):
     # {{{
     oh = ohloh.get_ohloh()
     projects, web_response = oh.get_contribution_info_by_username('keescook')
     self.assert_(len(projects) > 1)