<s> """<STR_LIT>""" <EOL> from django . conf import settings <EOL> from django . core . urlresolvers import reverse <EOL> from django_openstack import models <EOL> from django_openstack . nova . tests . base import BaseViewTests <EOL> class CredentialViewTests ( BaseViewTests ) : <EOL> def test_download_expired_credentials ( self ) : <EOL> auth_token = '<STR_LIT>' <EOL> self . mox . StubOutWithMock ( models . CredentialsAuthorization , <EOL> '<STR_LIT>' ) <EOL> models . CredentialsAuthorization . get_by_token ( auth_token ) . AndReturn ( None ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( reverse ( '<STR_LIT>' , <EOL> args = [ auth_token ] ) ) <EOL> self . assertTemplateUsed ( res , <EOL> '<STR_LIT>' ) <EOL> self . mox . VerifyAll ( ) <EOL> def test_download_good_credentials ( self ) : <EOL> auth_token = '<STR_LIT>' <EOL> creds = models . CredentialsAuthorization ( ) <EOL> creds . username = '<STR_LIT:test>' <EOL> creds . project = '<STR_LIT:test>' <EOL> creds . auth_token = auth_token <EOL> self . mox . StubOutWithMock ( models . CredentialsAuthorization , <EOL> '<STR_LIT>' ) <EOL> self . mox . StubOutWithMock ( creds , '<STR_LIT>' ) <EOL> models . CredentialsAuthorization . get_by_token ( auth_token ) . AndReturn ( creds ) <EOL> creds . get_zip ( ) . AndReturn ( '<STR_LIT>' ) <EOL> self . mox . ReplayAll ( ) <EOL> res = self . client . get ( reverse ( '<STR_LIT>' , <EOL> args = [ auth_token ] ) ) <EOL> self . assertEqual ( res . status_code , <NUM_LIT:200> ) <EOL> self . assertEqual ( res [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' % <EOL> settings . SITE_NAME ) <EOL> self . assertContains ( res , '<STR_LIT>' ) <EOL> self . mox . VerifyAll ( ) </s>
