def test_add_new_shelf(self):
     # тест: вернула ли функция True или False в зависимости от входных данных:
     self.assertEqual(app.add_new_shelf('new_test_shelf'),
                      ('new_test_shelf', True))
     self.assertEqual(app.add_new_shelf('1'), ('1', False))
     # тест: появился ли действительно новый элемент в directories
     self.assertIn('new_test_shelf', app.directories.keys())
예제 #2
0
    def test_add_new_shelf(self):
        with patch('app.input') as in_mock:
            in_mock.return_value = '4'
            shelf_nubmer, shelf_nubmer_bool = app.add_new_shelf()
            self.assertTrue(shelf_nubmer_bool)

            in_mock.return_value = '1'
            shelf_nubmer, shelf_nubmer_bool = app.add_new_shelf()
            self.assertFalse(shelf_nubmer_bool)
예제 #3
0
    def test_add_new_shelf(self):
        shelf_before = list(app.directories.keys())
        self.assertTrue(shelf_before)

        self.assertTupleEqual(app.add_new_shelf(shelf_before[0]),
                              (shelf_before[0], False))

        new_shelf = 'new'
        with patch('app.input', return_value=new_shelf):
            self.assertTupleEqual(app.add_new_shelf(), (new_shelf, True))
예제 #4
0
 def test_add_new_shelf(self):
     shelf_num = '999999'
     with patch('app.input', return_value=shelf_num):
         result_true = app.add_new_shelf()
     with patch('app.input', return_value=shelf_num):
         result_false = app.add_new_shelf()
     self.assertTrue(result_true[1])
     self.assertEqual(shelf_num, result_true[0])
     self.assertFalse(result_false[1])
     self.assertEqual(shelf_num, result_false[0])
예제 #5
0
    def test_add_new_shelf(self):
        user_input = ['4']
        with patch('app.input', side_effect=user_input):
            shelf_number, flag = app.add_new_shelf()
        self.assertEqual(shelf_number, '4')
        self.assertTrue(flag)

        user_input = ['2']
        with patch('app.input', side_effect=user_input):
            shelf_number, flag = app.add_new_shelf()
        self.assertEqual(shelf_number, '2')
        self.assertFalse(flag)
예제 #6
0
 def test_add_new_doc_shelf(self):
     result = app.add_new_doc('2207 876234', 'passport', 'Василий Гупкин',
                              '1')
     assert result == '1'
     result = app.add_new_doc('11-2', 'invoice', 'Геннадий Покемонов', '1')
     assert result == '1'
     result = app.add_new_doc('10006', 'insurance', 'Аристарх Павлов', '2')
     assert result == '2'
     shelf_num, is_new = app.add_new_shelf(3)
     assert shelf_num == '3'
     assert is_new
     etalon_docs = app.update_documents()
     etalon_dirs = app.update_directories()
     assert app.documents == etalon_docs
     assert app.directories == etalon_dirs
예제 #7
0
 def test_add_new_shelf(self):
     shelf_quantity_before = len(self.dirs)
     app.add_new_shelf('4')
     shelf_quantity_after = len(self.dirs)
     self.assertLess(shelf_quantity_before, shelf_quantity_after)
예제 #8
0
파일: tests.py 프로젝트: Nichi13/homework
 def test_1(self, directories):
     directories.return_value = self.directories
     old_dict = directories.copy()
     add_new_shelf('55555')
     self.assertNotEqual(old_dict, directories)
예제 #9
0
 def test_add_new_shelf(self):
     before_add = copy.deepcopy(self.dirs)
     with patch('app.input', return_value='5'):
         app.add_new_shelf()
     self.assertNotEqual(self.dirs, before_add)
예제 #10
0
 def test_add_new_shelf(self):
     with patch('app.input', return_value='5') as _:
         self.assertTrue(app.add_new_shelf())
예제 #11
0
 def test_negative_add_new_shelf(self):
     shelf_num = '1'
     self.assertIn(shelf_num, app.directories.keys())
     with patch('app.input', return_value=shelf_num):
         result = app.add_new_shelf()
     self.assertFalse(result[1])
예제 #12
0
 def test_add_new_shelf(self):
     before_len = len(self.dirs.keys())
     with patch('app.input', return_value='test'):
         app.add_new_shelf()
     self.assertGreater(len(self.dirs), before_len)
예제 #13
0
 def test_add_new_shelf(self):
     before_len = len(app.directories)
     app.add_new_shelf(shelf_number=4)
     self.assertGreater(len(app.directories), before_len)
예제 #14
0
 def test_add_new_shelf2(self, mock_shelf2):
     mock_shelf2.return_value = '2'
     result = add_new_shelf()
     self.assertEqual(('2', False), result)
예제 #15
0
    def test_add_new_shelf(self):

        self.assertNotIn('4', app.directories)
        with patch('app.input', return_value='4'):
            app.add_new_shelf('4')
        self.assertIn('4', app.directories)
예제 #16
0
 def test_add_new_shelf(self):
     with patch('app.input', return_value='4'):
         app.add_new_shelf()
         self.assertIn('4', self.dirs.keys())
예제 #17
0
 def test_add_new_shelf(self):
     with patch('app.input', return_value="4"):
         app.add_new_shelf()
     self.assertIn('4', directories.keys())
예제 #18
0
 def test_add_new_shelf(self):
     app.add_new_shelf('4')
     self.assertEqual(len(self.dirs), 4)
 def test_add_new_shelf(self):
     with patch('app.input', return_value='4'):
         self.assertIn(app.add_new_shelf()[0], directories.keys())
예제 #20
0
 def test_new_shelf(self):
     with patch('app.input', return_value="9999"):
         app.add_new_shelf()
         self.assertGreater(len(self.dirs), self.shelf_length)
예제 #21
0
 def testing_add_new_shelf(self):
     with patch('app.input', return_value='testNum'):
         app.add_new_shelf()
     self.assertIs(len(app.directories), 4)
예제 #22
0
파일: main_2.py 프로젝트: Shurgannn/tests
 def test_add_new_shelf(self):
     self.assertTrue(app.add_new_shelf("6")[1])
     self.assertFalse(app.add_new_shelf("1")[1])
예제 #23
0
 def test_add_new_shelf(self):
     shelf_num = '345'
     self.assertNotIn(shelf_num, app.directories.keys())
     with patch('app.input', return_value=shelf_num):
         app.add_new_shelf()
     self.assertIn(shelf_num, app.directories.keys())
예제 #24
0
 def test_add_new_shelf(self, mock_shelf):
     mock_shelf.return_value = '5'
     result = add_new_shelf()
     self.assertEqual(('5', True), result)
예제 #25
0
 def test_add_new_shelf(self):
     start_len = (len(directories))
     test_value = '12'
     self.assertNotIn(test_value, directories.keys())
     app.add_new_shelf(test_value)
     self.assertNotEqual(start_len, len(directories))