Пример #1
0
 def test_create_heso(self):
     heso = {'description': "This is description.",
             'files': [{'filename': "heso_test.py",
                       'document': "import heso"}]}
     application.create_heso(heso)
     diff = self._get_diff_repos()
     self.assertEqual(len(diff), 1)
Пример #2
0
 def test_get_heso(self):
     heso = self._make_heso()
     application.create_heso(heso)
     reponame = self._get_diff_repos()[0]
     result = application.get_heso(reponame)
     self.assertEqual(result['description'], heso['description'])
     self.assertEqual(result['files'][0]['filename'],
                      heso['files'][0]['filename'])
Пример #3
0
 def test_destroy_heso(self):
     heso = {'description':"This is description.",
             'files':[{'filename':"heso_test.py",
                       'document':"import heso"}]}
     application.create_heso(heso)
     reponame = self._get_diff_repos()[0]
     application.destroy_heso(reponame)
     self.assert_(reponame not in self._get_current_repos())
Пример #4
0
 def test_get_heso(self):
     heso = {'description': "This is description.",
             'files':[{'filename': "heso_test.py",
                       'document': "import heso"}]}
     application.create_heso(heso)
     reponame = self._get_diff_repos()[0]
     result = application.get_heso(reponame)
     self.assertEqual(result['description'], heso['description'])
     self.assertEqual(result['files'][0]['filename'],
                      heso['files'][0]['filename'])
Пример #5
0
    def test_get_all_heso(self):
        for i in xrange(3):
            heso = self._make_heso()
            heso['description'] = "Heso description number {0}.".format(i + 1)
            application.create_heso(heso)

        all_heso = application.get_all_heso()
        expected = self._get_current_repos()
        for heso in all_heso:
            self.assert_(heso['reponame'] in expected)
Пример #6
0
    def test_update_heso(self):
        heso = self._make_heso()
        application.create_heso(heso)
        reponame = self._get_diff_repos()[0]
        expected = application.get_heso(reponame)
        expected['description'] = "This heso is updated."
        application.update_heso(reponame, expected)

        result = application.get_heso(reponame)
        self.assertEqual(result['description'], expected['description'])
        self.assertEqual(result['files'][0]['filename'],
                         expected['files'][0]['filename'])
Пример #7
0
    def test_comment(self):
        heso = self._make_heso()
        application.create_heso(heso)
        reponame = self._get_diff_repos()[0]

        begin_comments = application.get_all_comment(reponame)
        for i in xrange(3):
            comment = "This is test comment number {0}.".format(i + 1)
            application.add_comment(reponame, comment)
            time.sleep(0.001)  # fixme: I don't want to use sleep!
        comments = application.get_all_comment(reponame)
        self.assertEqual(len(comments), len(begin_comments) + 3)
Пример #8
0
    def test_get_history(self):
        heso = self._make_heso()
        application.create_heso(heso)
        reponame = self._get_diff_repos()[0]

        heso['files'][0]['document'] = "This heso is updated once."
        application.update_heso(reponame, heso)
        heso['files'][0]['document'] = "This heso is updated twice."
        application.update_heso(reponame, heso)

        history = application.get_history(reponame)
        self.assertEqual(len(history), 3)
Пример #9
0
    def test_update_heso(self):
        heso = {'description':"This is description.",
                'files':[{'filename':"heso_test.py",
                          'document':"import heso"}]}
        application.create_heso(heso)
        reponame = self._get_diff_repos()[0]
        expected = application.get_heso(reponame)
        expected['description'] = "This heso is updated."
        application.update_heso(reponame, expected)

        result = application.get_heso(reponame)
        self.assertEqual(result['description'], expected['description'])
        self.assertEqual(result['files'][0]['filename'],
                         expected['files'][0]['filename'])
Пример #10
0
    def test_comment(self):
        heso = {'description': "This is description.",
                'files': [{'filename': "heso_test.py",
                          'document': "import heso"}]}
        application.create_heso(heso)
        reponame = self._get_diff_repos()[0]

        begin_comments = application.get_all_comment(reponame)

        comment1 = "This is test comment 1."
        application.add_comment(reponame, comment1)
        time.sleep(0.001)  # fixme: I don't want to use sleep!

        comment2 = "This is test comment 2."
        application.add_comment(reponame, comment2)
        time.sleep(0.001)  # fixme: I don't want to use sleep!

        comment3 = "This is test comment 3."
        application.add_comment(reponame, comment3)

        comments = application.get_all_comment(reponame)

        self.assertEqual(len(comments), len(begin_comments) + 3)
        self.assertEqual(comments[-1], comment3)
Пример #11
0
 def test_get_all_heso(self):
     heso1 = {'description': "This is description. I am Heso 1.",
             'files': [{'filename': "heso_test.py",
                       'document': "import heso"}]}
     application.create_heso(heso1)
     heso2 = {'description': "This is description. I am Heso 2.",
             'files': [{'filename': "heso_test.py",
                       'document': "import heso"}]}
     application.create_heso(heso2)
     heso3 = {'description': "This is description.  I am Heso 3.",
             'files': [{'filename': "heso_test.py",
                       'document': "import heso"}]}
     application.create_heso(heso3)
     
     all_heso = application.get_all_heso()
     expected = self._get_current_repos()
     for heso in all_heso:
         self.assert_(heso['reponame'] in expected)
Пример #12
0
 def test_destroy_heso(self):
     heso = self._make_heso()
     application.create_heso(heso)
     reponame = self._get_diff_repos()[0]
     application.destroy_heso(reponame)
     self.assert_(reponame not in self._get_current_repos())
Пример #13
0
 def test_create_heso(self):
     heso = self._make_heso()
     application.create_heso(heso)
     diff = self._get_diff_repos()
     self.assertEqual(len(diff), 1)