コード例 #1
0
 def test_number1(self, mockconnection, mockinput):
     mocksql = mock.Mock()
     mocksql.cursor().commit.return_value = True
     mocksql.cursor().fetchone.return_value = (1, 'shrey', 'shrey', 'Shreya', 'Bangalore', 560034, 27, None, None, None)
     g = Admin(mocksql, 1)
     m = g.number_1()
     assert m is True
コード例 #2
0
 def test_number1_exception(self, mockconnection, mockinput):
     mocksql = mock.Mock()
     mocksql.cursor().execute.side_effect = sqlite3.Error
     g = Admin(mocksql, 1)
     m = g.number_1()
     assert m is False