From c35f89e9af4ce6851914526e6e239205af48a2fb Mon Sep 17 00:00:00 2001 From: rachmadaniHaryono Date: Sun, 28 Apr 2019 14:10:39 +0800 Subject: [PATCH] new: test: exportdb to db --- tests/test_bukuDb.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py index 2177d4e..10f8dab 100644 --- a/tests/test_bukuDb.py +++ b/tests/test_bukuDb.py @@ -1435,6 +1435,17 @@ def test_exportdb_single_rec(tmpdir): assert f.read() +def test_exportdb_to_db(): + with NamedTemporaryFile(delete=False) as f1, NamedTemporaryFile(delete=False, suffix='.db') as f2: + db = BukuDb(dbfile=f1.name) + db.add_rec('http://example.com') + db.add_rec('http://google.com') + with mock.patch('builtins.input', return_value='y'): + db.exportdb(f2.name) + db2 = BukuDb(dbfile=f2.name) + assert db.get_rec_all() == db2.get_rec_all() + + @pytest.mark.parametrize( 'urls, exp_res', [