@@ -17,15 +17,16 @@ def mock_lookup_source(path, stream=False, source=None):
1717 resp .status_code = 200
1818 resp ._content_consumed = True
1919 # resp.headers['X-Fake-Source-Header'] = 'foobar'
20- if path .endswith ('0145 /layer' ):
20+ if path .endswith ('01451234 /layer' ):
2121 resp ._content = "abcdef0123456789xxxxxx=-//"
22- elif path .endswith ('0145 /json' ):
23- resp ._content = ('{"id": "cafebabe0145","created":"2014-02-03T16:47:06 '
24- '.615279788Z"}' )
25- elif path .endswith ('0145 /ancestry' ):
26- resp ._content = '["cafebabe0145 "]'
22+ elif path .endswith ('01451234 /json' ):
23+ resp ._content = ('{"id": "cafebabe01451234", '
24+ '"created":"2014-02-03T16:47:06 .615279788Z"}' )
25+ elif path .endswith ('01451234 /ancestry' ):
26+ resp ._content = '["cafebabe01451234 "]'
2727 elif path .endswith ('test/tags' ):
28- resp ._content = '{"latest": "cafebabe0145", "0.1.2": "cafebabe0145"}'
28+ resp ._content = ('{"latest": "cafebabe01451234", "0.1.2": '
29+ '"cafebabe01451234"}' )
2930 else :
3031 resp .status_code = 404
3132
@@ -52,24 +53,24 @@ def test_is_mirror(self):
5253 @mock .patch ('docker_registry.lib.mirroring.lookup_source' ,
5354 mock_lookup_source )
5455 def test_source_lookup (self ):
55- resp = self .http_client .get ('/v1/images/cafebabe0145 /layer' )
56+ resp = self .http_client .get ('/v1/images/cafebabe01451234 /layer' )
5657 self .assertEqual (resp .status_code , 200 )
5758 self .assertEqual (resp .data , "abcdef0123456789xxxxxx=-//" )
5859
59- resp_2 = self .http_client .get ('/v1/images/cafebabe0145 /json' )
60+ resp_2 = self .http_client .get ('/v1/images/cafebabe01451234 /json' )
6061 self .assertEqual (resp_2 .status_code , 200 )
6162 # Note(dmp): unicode patch XXX not applied assume requests does the job
6263 json_data = json .loads (resp_2 .data )
6364 assert 'id' in json_data
6465 assert 'created' in json_data
65- self .assertEqual (json_data ['id' ], 'cafebabe0145 ' )
66+ self .assertEqual (json_data ['id' ], 'cafebabe01451234 ' )
6667
67- resp_3 = self .http_client .get ('/v1/images/cafebabe0145 /ancestry' )
68+ resp_3 = self .http_client .get ('/v1/images/cafebabe01451234 /ancestry' )
6869 self .assertEqual (resp_3 .status_code , 200 )
6970 # Note(dmp): unicode patch XXX not applied assume requests does the job
7071 json_data_2 = json .loads (resp_3 .data )
7172 self .assertEqual (len (json_data_2 ), 1 )
72- self .assertEqual (json_data_2 [0 ], 'cafebabe0145 ' )
73+ self .assertEqual (json_data_2 [0 ], 'cafebabe01451234 ' )
7374
7475 resp_4 = self .http_client .get ('/v1/images/doe587e8157/json' )
7576 self .assertEqual (resp_4 .status_code , 404 )
@@ -81,7 +82,7 @@ def test_source_lookup_tag(self):
8182 self .assertEqual (resp .status_code , 200 )
8283 self .assertEqual (
8384 resp .data ,
84- '{"latest": "cafebabe0145 ", "0.1.2": "cafebabe0145 "}'
85+ '{"latest": "cafebabe01451234 ", "0.1.2": "cafebabe01451234 "}'
8586 )
8687
8788 resp_2 = self .http_client .get ('/v1/repositories/testing/bogus/tags' )
0 commit comments