<s> from __future__ import absolute_import , unicode_literals , division <EOL> import json <EOL> from armet import http <EOL> from . base import BaseResourceTest <EOL> class TestResourcePut ( BaseResourceTest ) : <EOL> def test_put_existing ( self , connectors ) : <EOL> data = { '<STR_LIT:id>' : <NUM_LIT:1> , '<STR_LIT>' : '<STR_LIT>' } <EOL> body = json . dumps ( data ) <EOL> response , content = self . client . put ( <EOL> path = '<STR_LIT>' , body = body , <EOL> headers = { '<STR_LIT:Content-Type>' : '<STR_LIT:application/json>' } ) <EOL> assert response . status == http . client . OK <EOL> data = json . loads ( content . decode ( '<STR_LIT:utf8>' ) ) <EOL> assert isinstance ( data , dict ) <EOL> assert data [ '<STR_LIT>' ] == '<STR_LIT>' <EOL> assert data [ '<STR_LIT:id>' ] == <NUM_LIT:1> <EOL> def test_put_nonexistant ( self ) : <EOL> request_data = { '<STR_LIT:id>' : <NUM_LIT> , '<STR_LIT>' : '<STR_LIT>' } <EOL> body = json . dumps ( request_data ) <EOL> response , content = self . client . put ( <EOL> path = '<STR_LIT>' , body = body , <EOL> headers = { '<STR_LIT:Content-Type>' : '<STR_LIT:application/json>' } ) <EOL> assert response . status == http . client . OK <EOL> data = json . loads ( content . decode ( '<STR_LIT:utf8>' ) ) <EOL> assert isinstance ( data , dict ) <EOL> assert set ( request_data . items ( ) ) <= set ( data . items ( ) ) </s>
