Logo Search packages:      
Sourcecode: ubuntu-sso-client version File versions  Download package

def ubuntu_sso::tests::test_key_acls::Loader::test_etc_files_parsed (   self  ) 

Are files in /etc parsed correctly?

Definition at line 104 of file test_key_acls.py.

00104                                    :
        """Are files in /etc parsed correctly?"""
        FILE_LIST = ["a", "b"]
        osp = self.mocker.replace("os.path")
        osp.exists(ETC_FOLDER)
        self.mocker.result(True)
        osp.isdir(ETC_FILES_FOLDER)
        self.mocker.result(True)
        listdir = self.mocker.replace("os.listdir")
        listdir(ETC_FILES_FOLDER)
        self.mocker.result(FILE_LIST)

        sio1 = StringIO.StringIO("""[app1]
realm = https://realm.example.com/
consumer_key = example_key
exe_path = /nowhere/executable/path
application_name = example_app_name

[app2]
realm = https://other.example.com/
consumer_key = example_key
exe_path = /nowhere/executable/path
application_name = example_app_name

""")
        sio2 = StringIO.StringIO("""[app3]
exe_path = /nowhere/path/2
application_name = example_app_name2
consumer_key = example_key2
realm = https://realm2.example.com/
""")
        mock_open = self.mocker.replace(open)
        mock_open(os.path.join(ETC_FILES_FOLDER, "a"))
        self.mocker.result(sio1)
        mock_open(os.path.join(ETC_FILES_FOLDER, "b"))
        self.mocker.result(sio2)

        ssa = self.mocker.replace("ubuntu_sso.key_acls.set_single_acl")
        # list may come up in any order
        ssa(IN([
              [
                ("https://realm.example.com/", "example_key",
                "/nowhere/executable/path", "example_app_name"),
                ("https://other.example.com/", "example_key",
                "/nowhere/executable/path", "example_app_name"),
              ],
              [
                ("https://other.example.com/", "example_key",
                "/nowhere/executable/path", "example_app_name"),
                ("https://realm.example.com/", "example_key",
                "/nowhere/executable/path", "example_app_name"),
              ],
            ]), specific_item_id=None
        )
        self.mocker.result(None)
        ssa([
            ("https://realm2.example.com/", "example_key2",
            "/nowhere/path/2", "example_app_name2")
            ], specific_item_id=None)
        self.mocker.result(None)
        self.mocker.replay()

        set_all_key_acls(use_source_tree_folder=False)
        set_all_key_acls(use_source_tree_folder=False)


Generated by  Doxygen 1.6.0   Back to index