Пример #1
0
    def test_snap_config_add_snap_user_email_only(self, mock_util):
        email = "*****@*****.**"
        cfg = {"email": email}
        mock_util.which.return_value = None
        mock_util.system_is_snappy.return_value = True
        mock_util.subp.side_effect = [("false\n", "")]  # snap managed

        usercfg = add_snap_user(cfg=cfg)

        self.assertEqual(usercfg, {"snapuser": email, "known": False})
Пример #2
0
    def test_snap_config_add_snap_user_email_only(self, mock_util):
        email = '*****@*****.**'
        cfg = {'email': email}
        mock_util.which.return_value = None
        mock_util.system_is_snappy.return_value = True
        mock_util.subp.side_effect = [
            ("false\n", ""),  # snap managed
        ]

        usercfg = add_snap_user(cfg=cfg)

        self.assertEqual(usercfg, {'snapuser': email, 'known': False})
Пример #3
0
    def test_snap_config_add_snap_user_email_only(self, mock_util):
        email = '*****@*****.**'
        cfg = {'email': email}
        mock_util.which.return_value = None
        mock_util.system_is_snappy.return_value = True
        mock_util.subp.side_effect = [
            ("false\n", ""),  # snap managed
        ]

        usercfg = add_snap_user(cfg=cfg)

        self.assertEqual(usercfg, {'snapuser': email, 'known': False})
Пример #4
0
    def test_snap_config_add_snap_user_email_known(self, mock_util):
        email = '*****@*****.**'
        known = True
        cfg = {'email': email, 'known': known}
        mock_util.which.return_value = None
        mock_util.system_is_snappy.return_value = True
        mock_util.subp.side_effect = [
            ("false\n", ""),  # snap managed
            (self.SYSTEM_USER_ASSERTION, ""),  # snap known system-user
        ]

        usercfg = add_snap_user(cfg=cfg)

        self.assertEqual(usercfg, {'snapuser': email, 'known': known})
Пример #5
0
    def test_snap_config_add_snap_user_email_known(self, mock_util):
        email = "*****@*****.**"
        known = True
        cfg = {"email": email, "known": known}
        mock_util.which.return_value = None
        mock_util.system_is_snappy.return_value = True
        mock_util.subp.side_effect = [
            ("false\n", ""),  # snap managed
            (self.SYSTEM_USER_ASSERTION, ""),  # snap known system-user
        ]

        usercfg = add_snap_user(cfg=cfg)

        self.assertEqual(usercfg, {"snapuser": email, "known": known})
Пример #6
0
 def test_snap_config_add_snap_user_no_email(self):
     cfg = {'assertions': [], 'known': True}
     usercfg = add_snap_user(cfg=cfg)
     self.assertIsNone(usercfg)
Пример #7
0
 def test_snap_config_add_snap_user_no_config(self):
     usercfg = add_snap_user(cfg=None)
     self.assertIsNone(usercfg)
Пример #8
0
 def test_snap_config_add_snap_user_no_config(self):
     usercfg = add_snap_user(cfg=None)
     self.assertEqual(usercfg, None)
Пример #9
0
 def test_snap_config_add_snap_user_no_email(self):
     cfg = {"assertions": [], "known": True}
     usercfg = add_snap_user(cfg=cfg)
     self.assertEqual(usercfg, None)
Пример #10
0
 def test_snap_config_add_snap_user_no_config(self):
     usercfg = add_snap_user(cfg=None)
     self.assertEqual(usercfg, None)
Пример #11
0
 def test_snap_config_add_snap_user_no_email(self):
     cfg = {'assertions': [], 'known': True}
     usercfg = add_snap_user(cfg=cfg)
     self.assertIsNone(usercfg)
Пример #12
0
 def test_snap_config_add_snap_user_no_config(self):
     usercfg = add_snap_user(cfg=None)
     self.assertIsNone(usercfg)