コード例 #1
0
ファイル: __init__.py プロジェクト: h4ck3rm1k3/git-review-old
 def add_known_hosts(exc_info):
     known_hosts = self._dir('ssh', 'known_hosts')
     if os.path.exists(known_hosts):
         content.attach_file(self, known_hosts)
     else:
         self.addDetail('known_hosts',
                        content.text_content('Not found'))
コード例 #2
0
 def test_simple(self):
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     data = 'some data'
     path = self.make_file(data)
     my_content = text_content(data)
     attach_file(test, path, name='foo')
     self.assertEqual({'foo': my_content}, test.getDetails())
コード例 #3
0
ファイル: test_content.py プロジェクト: ClusterHQ/testtools
 def test_simple(self):
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     data = 'some data'
     path = self.make_file(data)
     my_content = text_content(data)
     attach_file(test, path, name='foo')
     self.assertEqual({'foo': my_content}, test.getDetails())
コード例 #4
0
ファイル: test_content.py プロジェクト: 0x90shell/pth-toolkit
    def test_simple(self):
        class SomeTest(TestCase):
            def test_foo(self):
                pass

        test = SomeTest("test_foo")
        data = "some data"
        path = self.make_file(data)
        my_content = text_content(data)
        attach_file(test, path, name="foo")
        self.assertEqual({"foo": my_content}, test.getDetails())
コード例 #5
0
ファイル: test_content.py プロジェクト: ClusterHQ/testtools
 def test_optional_name(self):
     # If no name is provided, attach_file just uses the base name of the
     # file.
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     path = self.make_file('some data')
     base_path = os.path.basename(path)
     attach_file(test, path)
     self.assertEqual([base_path], list(test.getDetails()))
コード例 #6
0
 def test_optional_name(self):
     # If no name is provided, attach_file just uses the base name of the
     # file.
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     path = self.make_file('some data')
     base_path = os.path.basename(path)
     attach_file(test, path)
     self.assertEqual([base_path], list(test.getDetails()))
コード例 #7
0
ファイル: test_content.py プロジェクト: ClusterHQ/testtools
 def test_eager_read_by_default(self):
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     path = self.make_file('some data')
     attach_file(test, path, name='foo')
     content = test.getDetails()['foo']
     content_file = open(path, 'w')
     content_file.write('new data')
     content_file.close()
     self.assertEqual(''.join(content.iter_text()), 'some data')
コード例 #8
0
 def test_eager_read_by_default(self):
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     path = self.make_file('some data')
     attach_file(test, path, name='foo')
     content = test.getDetails()['foo']
     content_file = open(path, 'w')
     content_file.write('new data')
     content_file.close()
     self.assertEqual(''.join(content.iter_bytes()), 'some data')
コード例 #9
0
 def test_lazy_read(self):
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     path = self.make_file('some data')
     attach_file(test, path, name='foo', buffer_now=False)
     content = test.getDetails()['foo']
     content_file = open(path, 'w')
     content_file.write('new data')
     content_file.close()
     self.assertEqual(''.join(content.iter_bytes()), 'new data')
コード例 #10
0
ファイル: test_content.py プロジェクト: cpatulea/samba
 def test_lazy_read(self):
     class SomeTest(TestCase):
         def test_foo(self):
             pass
     test = SomeTest('test_foo')
     path = self.make_file('some data')
     attach_file(test, path, name='foo', buffer_now=False)
     content = test.getDetails()['foo']
     content_file = open(path, 'w')
     content_file.write('new data')
     content_file.close()
     self.assertEqual(''.join(content.iter_text()), 'new data')
コード例 #11
0
ファイル: test_content.py プロジェクト: 0x90shell/pth-toolkit
    def test_eager_read_by_default(self):
        class SomeTest(TestCase):
            def test_foo(self):
                pass

        test = SomeTest("test_foo")
        path = self.make_file("some data")
        attach_file(test, path, name="foo")
        content = test.getDetails()["foo"]
        content_file = open(path, "w")
        content_file.write("new data")
        content_file.close()
        self.assertEqual("".join(content.iter_text()), "some data")
コード例 #12
0
ファイル: __init__.py プロジェクト: h4ck3rm1k3/git-review-old
 def add_logs(exc_info):
     for name in ['error_log', 'sshd_log', 'httpd_log']:
         content.attach_file(self, self._dir('site', 'logs', name))
コード例 #13
0
ファイル: __init__.py プロジェクト: fkalinski/git-review
 def attach_file(exc_info):
     if os.path.exists(filename):
         content.attach_file(self, filename)
     else:
         self.addDetail(os.path.basename(filename),
                        content.text_content('Not found'))
コード例 #14
0
 def attach_file(exc_info):
     if os.path.exists(filename):
         content.attach_file(self, filename)
     else:
         self.addDetail(os.path.basename(filename),
                        content.text_content('Not found'))