Esempio n. 1
0
    def test_crud_bytes(self):

        mr = MemoryResource(dir)
        body = b"\x00\x0e\0x01\0x01\0x00"
        id = "binary"
        self.assertEqual(id, mr.create(id, body)["id"])
        self.assertEqual(mr.list(), [id])
        self.assertEqual(body, mr.read(id))
        body = bytes((1, 2, 3, 4, 5))
        mr.update(id, body)
        self.assertEqual(body, mr.read(id))
        mr.delete(id)
        self.assertEqual(mr.list(), [])
Esempio n. 2
0
def test_crud_bytes():

    mr = MemoryResource()
    body = b"\x00\x0e\0x01\0x01\0x00"
    id = "binary"
    assert mr.create(id, body)["id"] == id
    assert mr.list() == [id]
    assert mr.read(id) == body
    body = bytes((1, 2, 3, 4, 5))
    mr.update(id, body)
    assert mr.read(id) == body
    mr.delete(id)
    assert mr.list() == []
Esempio n. 3
0
def test_delete_notfound():
    mr = MemoryResource()
    with pytest.raises(NotFound):
        mr.delete("1")
Esempio n. 4
0
 def test_delete_notfound(self):
     mr = MemoryResource()
     with self.assertRaises(NotFound):
         mr.delete("1")