コード例 #1
0
 def test_remove_deletes_items_by_key(self):
     storage = Storage(self.DB_FILE_NAME)
     storage.insert_items(self.TEST_SITE1, self.MORE_DATA)
     storage.remove_items(self.TEST_SITE1, self.DATA)
     self.assertTrue('key' not in storage.get_items(self.TEST_SITE1), "Should not contain removed items")
     self.assertTrue('newKey' in storage.get_items(self.TEST_SITE1), "Should contain key that was not passed for removal")
コード例 #2
0
 def test_select_doesnt_return_data_for_other_site(self):
     storage = Storage(self.DB_FILE_NAME)
     storage.insert_items(self.TEST_SITE1, self.DATA)
     self.assertTrue(storage.get_items(self.TEST_SITE2) == {}, "Should have no data for site2 as it wasn't inserted")
コード例 #3
0
 def test_select_retrieves_updated_data(self):
     storage = Storage(self.DB_FILE_NAME)
     storage.insert_items(self.TEST_SITE1, self.MORE_DATA)
     storage.change_items(self.TEST_SITE1, self.DATA)
     self.assertTrue(storage.get_items(self.TEST_SITE1)['key'] == 100, "Should have updated value for key")
コード例 #4
0
 def test_select_returns_inserted_data(self):
     storage = Storage(self.DB_FILE_NAME)
     storage.insert_items(self.TEST_SITE1, self.DATA)
     self.assertTrue(storage.get_items(self.TEST_SITE1) == self.DATA, "Should return inserted items")