コード例 #1
0
 def test_addnewroute(self, mockconnection, mockinput):
     mocksql = mock.Mock()
     mocksql.cursor().commit.return_value = True
     mocksql.cursor().fetchall.return_value = [(1, 'shrey', 'shrey', 'Shreya', 'Bangalore', 560034, 27, None, None,
                                                None, 'shreya', 'shreya', 'shreya', 'shreya')]
     g = Admin(mocksql, 1)
     m = g.add_new_route()
     assert m is True
コード例 #2
0
 def test_addnewroute_exception(self, mockconnection, mockinput):
     mocksql = mock.Mock()
     mocksql.cursor().execute.side_effect = sqlite3.Error
     g = Admin(mocksql, 1)
     m = g.add_new_route()
     assert m is False