コード例 #1
0
ファイル: test_diary_app.py プロジェクト: Blad1995/diary_app
 def test_get_owner_by_login(self):
     test_diary_control = DiaryControl(self.conf_path)
     test_diary_control.create_owner(login=LOGIN1, password=PASSWORD1)
     test_diary_control.create_owner(login=LOGIN2, password=PASSWORD2)
     self.assertIsNone(test_diary_control.get_owner_by_login("NotValid"))
     self.assertEqual(
         test_diary_control.get_owner_by_login("NotValid", "default"),
         "default")
     self.assertIsInstance(test_diary_control.get_owner_by_login(LOGIN1),
                           Owner)
     # Not consistent - order of the owners in list is not guaranteed
     self.assertIs(test_diary_control.get_owner_by_login(LOGIN1),
                   test_diary_control.owners[0])
コード例 #2
0
ファイル: test_diary_app.py プロジェクト: Blad1995/diary_app
    def test_delete_owner_by_login(self):
        test_diary_control = DiaryControl(self.conf_path)
        test_diary_control.create_owner(login=LOGIN1, password=PASSWORD1)
        test_diary_control.create_owner(login=LOGIN2, password=PASSWORD2)
        test_diary_control.delete_owner_by_login(del_login=LOGIN1)
        self.assertEqual(test_diary_control.owners.__len__(), 1)
        self.assertIsNone(test_diary_control.get_owner_by_login(LOGIN1))

        self.assertRaises(ValueError, test_diary_control.delete_owner_by_login,
                          LOGIN1)
        self.assertRaises(ValueError, test_diary_control.delete_owner_by_login,
                          None)