File: write_files.py

package info (click to toggle)
cloud-init 20.2-2~deb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,276 kB
  • sloc: python: 69,663; sh: 3,915; makefile: 105; xml: 21
file content (33 lines) | stat: -rw-r--r-- 1,150 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# This file is part of cloud-init. See LICENSE file for license information.

"""cloud-init Integration Test Verify Script."""
from tests.cloud_tests.testcases import base


class TestWriteFiles(base.CloudTestCase):
    """Example cloud-config test."""

    def test_b64(self):
        """Test b64 encoded file reads as ascii."""
        out = self.get_data_file('file_b64')
        self.assertIn('ASCII text', out)

    def test_binary(self):
        """Test binary file reads as executable."""
        out = self.get_data_file('file_binary').strip()
        md5 = "3801184b97bb8c6e63fa0e1eae2920d7"
        sha256 = ("2c791c4037ea5bd7e928d6a87380f8ba7a803cd83d"
                  "5e4f269e28f5090f0f2c9a")
        self.assertIn(out, (md5 + "  -", sha256 + "  -"))

    def test_gzip(self):
        """Test gzip file shows up as a shell script."""
        out = self.get_data_file('file_gzip')
        self.assertIn('POSIX shell script, ASCII text executable', out)

    def test_text(self):
        """Test text shows up as ASCII text."""
        out = self.get_data_file('file_text')
        self.assertIn('ASCII text', out)

# vi: ts=4 expandtab