Ejemplo n.º 1
0
 def test_remove_blob_non_existant_blob_id(self):
     # Setup
     filename = self.test_path + 'test_empty.json'
     # Test
     self.assertRaises(file_server.BlobNotFoundException,
                       file_server.remove_blob, filename, self.blob_id)
     wipe_json_file(filename)
Ejemplo n.º 2
0
 def test_write_db(self):
     # Setup
     expected_data = test_read_expected()
     # Test
     write_db(self.default_filename, expected_data)
     self.assertEqual(read_db(self.default_filename), expected_data)
     actual = read_db(self.default_filename)
     wipe_json_file(self.default_filename)
Ejemplo n.º 3
0
 def test_remove_blob(self):
     # Setup
     filename = self.test_path + 'test_empty.json'
     file_server.write_chunk(filename, self.chunk)
     # Test
     file_server.remove_blob(filename, self.blob_id)
     self.assertRaises(KeyError, file_server.read_chunk_payload, filename,
                       self.blob_id, self.index)
     wipe_json_file(filename)
Ejemplo n.º 4
0
 def test_remove_by_key_db(self):
     # Setup
     key = "1"
     input_data = test_read_expected()
     write_db(self.default_filename, input_data)
     expected = input_data
     del expected[key]
     # Test
     remove_by_key_db(self.default_filename, key)
     actual = read_db(self.default_filename)
     self.assertEqual(actual, expected)
     wipe_json_file(self.default_filename)
Ejemplo n.º 5
0
 def test_write_chunk(self):
     # Setup
     filename = self.test_path + 'test_empty.json'
     # Test
     file_server.write_chunk(filename, self.chunk)
     actual_payload = file_server.read_chunk_payload(
         filename, self.blob_id, self.index)
     self.assertEqual(actual_payload, self.payload)
     file_server.write_chunk(filename, self.chunk1)
     actual_payload = file_server.read_chunk_payload(
         filename, self.blob_id, self.index)
     self.assertEqual(actual_payload, self.payload)
     actual_payload = file_server.read_chunk_payload(
         filename, self.blob_id, self.index + 1)
     self.assertEqual(actual_payload, self.payload)
     wipe_json_file(filename)
Ejemplo n.º 6
0
 def test_remove_by_key_db_non_existant_key(self):
     self.assertRaises(KeyError, remove_by_key_db, self.default_filename,
                       "invalid_key")
     wipe_json_file(self.default_filename)
Ejemplo n.º 7
0
 def tearDown(self):
     wipe_json_file(self.default_filename)
Ejemplo n.º 8
0
 def setUp(self):
     wipe_json_file(self.default_filename)