コード例 #1
0
ファイル: test_gen_docs.py プロジェクト: JPWKU/unix-agent
    def test_gen_md_output(self):
        """
        :return: assertion that expected_output is legit
                 when remove_user.py and add_user.py are
                 run through gen_docs.py
        """

        fileone = 'remove_user.py'
        expected_output_fileone = """## remove_user.py parameters:
- userId: The unix account name of the user to remove
    - optional: True
    - type: str
    - default: None
"""

        filetwo = 'add_user.py'
        expected_output_filetwo = """## add_user.py parameters:
- administrator: A string that is either 'true' or 'false' which indicates if the new user should have ssh access
    - optional: True
    - type: str
    - default: None
- authentication: The user's ssh public key
    - optional: True
    - type: str
    - default: None
- firstName: The user's first name
    - optional: True
    - type: str
    - default: None
- lastName: The user's last name
    - optional: True
    - type: str
    - default: None
- userId: The new unix account name to be created
    - optional: True
    - type: Safe user name
    - default: None
"""

        # check remove_user.py
        x = gen_docs.dynamic_import(fileone)
        y = gen_docs.get_protocol_argument_dict(x)
        z = gen_docs.output_markdown(fileone, y)

        assert (z == expected_output_fileone)

        # check add_user.py
        a = gen_docs.dynamic_import(filetwo)
        b = gen_docs.get_protocol_argument_dict(a)
        c = gen_docs.output_markdown(filetwo, b)

        assert (c == expected_output_filetwo)
コード例 #2
0
    def test_gen_md_output(self):
        """
        :return: assertion that expected_output is legit
                 when remove_user.py and add_user.py are
                 run through gen_docs.py
        """

        fileone = 'remove_user.py'
        expected_output_fileone = """## remove_user.py parameters:
- userId: The unix account name of the user to remove
    - optional: True
    - type: str
    - default: None
"""

        filetwo = 'add_user.py'
        expected_output_filetwo = """## add_user.py parameters:
- administrator: A string that is either 'true' or 'false' which indicates if the new user should have ssh access
    - optional: True
    - type: str
    - default: None
- authentication: The user's ssh public key
    - optional: True
    - type: str
    - default: None
- firstName: The user's first name
    - optional: True
    - type: str
    - default: None
- lastName: The user's last name
    - optional: True
    - type: str
    - default: None
- userId: The new unix account name to be created
    - optional: True
    - type: Safe user name
    - default: None
"""

        # check remove_user.py
        x = gen_docs.dynamic_import(fileone)
        y = gen_docs.get_protocol_argument_dict(x)
        z = gen_docs.output_markdown(fileone, y)

        assert (z == expected_output_fileone)

        # check add_user.py
        a = gen_docs.dynamic_import(filetwo)
        b = gen_docs.get_protocol_argument_dict(a)
        c = gen_docs.output_markdown(filetwo, b)

        assert (c == expected_output_filetwo)
コード例 #3
0
ファイル: test_gen_docs.py プロジェクト: JPWKU/unix-agent
 def test_get_protocol_argument_dict(self):
     """
     :return: call get_protocol_argument_dict and assert
              that it returns a dict
     """
     for file in self.files:
         x = gen_docs.dynamic_import(file)
         y = gen_docs.get_protocol_argument_dict(x)
         # it is a dict
         assert (isinstance(y, dict))
コード例 #4
0
 def test_get_protocol_argument_dict(self):
     """
     :return: call get_protocol_argument_dict and assert
              that it returns a dict
     """
     for file in self.files:
         x = gen_docs.dynamic_import(file)
         y = gen_docs.get_protocol_argument_dict(x)
         # it is a dict
         assert (isinstance(y, dict))