#NEWLINE# def test_simple( self , repos_name = None ) : #NEWLINE# #INDENT# if ( repos_name is None ) : #NEWLINE# #INDENT# repos_name = self . gen_random_string ( ) #NEWLINE# #UNINDENT# image_id = self . gen_hex_string ( ) #NEWLINE# layer_data = self . gen_random_string ( 1024 ) #NEWLINE# self . upload_image ( image_id , parent_id = None , layer = layer_data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/latest' . format ( repos_name ) #NEWLINE# headers = { #NEWLINE# #INDENT# 'User-Agent' : 'docker/0.7.2-dev go/go1.2 os/ostest arch/archtest' , #NEWLINE# #UNINDENT# } #NEWLINE# resp = self . http_client . put ( url , headers = headers , data = json . dumps ( image_id ) ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/test' . format ( repos_name ) #NEWLINE# resp = self . http_client . put ( url , data = json . dumps ( image_id ) ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/latest' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# self . assertEqual ( json . loads ( resp . data ) , image_id , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/json' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# props = json . loads ( resp . data ) #NEWLINE# self . assertEqual ( props [ 'docker_version' ] , '0.7.2-dev' ) #NEWLINE# self . assertEqual ( props [ 'docker_go_version' ] , 'go1.2' ) #NEWLINE# self . assertEqual ( props [ 'os' ] , 'ostest' ) #NEWLINE# self . assertEqual ( props [ 'arch' ] , 'archtest' ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/latest/json' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# props = json . loads ( resp . data ) #NEWLINE# self . assertEqual ( props [ 'docker_version' ] , '0.7.2-dev' ) #NEWLINE# self . assertEqual ( props [ 'docker_go_version' ] , 'go1.2' ) #NEWLINE# self . assertEqual ( props [ 'os' ] , 'ostest' ) #NEWLINE# self . assertEqual ( props [ 'arch' ] , 'archtest' ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/latest' . format ( repos_name ) #NEWLINE# headers = { #NEWLINE# #INDENT# 'User-Agent' : 'docker/0.7.2-dev go/go1.2 os/ostest arch/changedarch' , #NEWLINE# #UNINDENT# } #NEWLINE# resp = self . http_client . put ( url , headers = headers , data = json . dumps ( image_id ) ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/test' . format ( repos_name ) #NEWLINE# resp = self . http_client . put ( url , headers = headers , data = json . dumps ( image_id ) ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/latest/json' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# props = json . loads ( resp . data ) #NEWLINE# self . assertEqual ( props [ 'docker_version' ] , '0.7.2-dev' ) #NEWLINE# self . assertEqual ( props [ 'docker_go_version' ] , 'go1.2' ) #NEWLINE# self . assertEqual ( props [ 'os' ] , 'ostest' ) #NEWLINE# self . assertEqual ( props [ 'arch' ] , 'changedarch' ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/test/json' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# props = json . loads ( resp . data ) #NEWLINE# self . assertEqual ( props [ 'docker_version' ] , '0.7.2-dev' ) #NEWLINE# self . assertEqual ( props [ 'docker_go_version' ] , 'go1.2' ) #NEWLINE# self . assertEqual ( props [ 'os' ] , 'ostest' ) #NEWLINE# self . assertEqual ( props [ 'arch' ] , 'changedarch' ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# self . assertEqual ( len ( json . loads ( resp . data ) ) , 2 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/latest' . format ( repos_name ) #NEWLINE# resp = self . http_client . delete ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags/latest' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 404 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/' . format ( self ) #NEWLINE# resp = self . http_client . delete ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 200 , resp . data ) #NEWLINE# url = '/v1/repositories/foo/{0}/tags' . format ( repos_name ) #NEWLINE# resp = self . http_client . get ( url ) #NEWLINE# self . assertEqual ( resp . status_code , 404 , resp . data )