Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from unittest import TestCase | ||
|
||
from pastycake.sqlite_backend import SqliteBackend | ||
|
||
|
||
class TestSqliteBackend(TestCase): | ||
def setUp(self): | ||
self.db = SqliteBackend(':memory:') | ||
|
||
def test_connected(self): | ||
self.assertFalse(self.db.connected()) | ||
|
||
def test_connect(self): | ||
self.assertFalse(self.db.connected()) | ||
self.db.connect() | ||
self.assertTrue(self.db.connected()) | ||
|
||
def test_already_visited_url(self): | ||
self.db.connect() | ||
self.assertTrue(self.db.connected()) | ||
|
||
self.assertFalse(self.db.already_visited_url('abc')) | ||
|
||
def test_save_url(self): | ||
self.db.connect() | ||
self.assertTrue(self.db.connected()) | ||
|
||
self.db.save_url('abc', '123') | ||
self.assertTrue(self.db.already_visited_url('abc')) |