def test_update_passphrase_file(self, *, rmock: requests_mock.Mocker) -> None: rmock.put("http://test/api/publish/s3%3Aaptly-repo%3Atest_xyz__1/test", text='{"Architectures":["amd64"],"Distribution":"test","Label":"",' '"Origin":"","Prefix":"test/xyz_1","SkipContents":false,' '"SourceKind":"local","Sources":[{"Component":"main","Name":"aptly-repo"}],' '"Storage":"s3:aptly-repo"}') self.assertEqual( self.papi.update( prefix="s3:aptly-repo:test/xyz_1", distribution="test", sign_batch=True, sign_gpgkey="A16BE921", sign_passphrase_file="/root/passphrase.txt", ), PublishEndpoint( storage='s3:aptly-repo', prefix='test/xyz_1', distribution='test', source_kind='local', sources=[{ 'Name': 'aptly-repo', 'Component': 'main' }], architectures=['amd64'], label='', origin='' ) )
def test_update_snapshot_default_key(self, *, rmock: requests_mock.Mocker) -> None: rmock.put("http://test/api/publish/s3%3Aaptly-repo%3Atest_xyz__1/test", text='{"Architectures":["amd64"],"Distribution":"test","Label":"",' '"Origin":"","Prefix":"test/xyz_1","SkipContents":false,' '"SourceKind":"snapshot","Sources":[{"Component":"main","Name":"aptly-repo-1"}],' '"Storage":"s3:aptly-repo"}') self.assertEqual( self.papi.update( prefix="s3:aptly-repo:test/xyz_1", distribution="test", snapshots=[{"Name": "aptly-repo-1"}], force_overwrite=True, sign_batch=True, sign_passphrase="123456", sign_keyring="/etc/gpg-managed-keyring/pubring.pub", sign_secret_keyring="/etc/gpg-managed-keyring/secring.gpg" ), PublishEndpoint( storage='s3:aptly-repo', prefix='test/xyz_1', distribution='test', source_kind='snapshot', sources=[{ 'Name': 'aptly-repo-1', 'Component': 'main', }], architectures=['amd64'], label='', origin='' ) )
def test_publish_no_sign(self, *, rmock: requests_mock.Mocker) -> None: rmock.post( "http://test/api/publish/s3%3Amyendpoint%3Atest_a__1", text= '{"Architectures":["amd64"],"Distribution":"test","Label":"test",' '"Origin":"origin","Prefix":"test/a_1","SkipContents":false,' '"SourceKind":"local","Sources":[{"Component":"main","Name":"aptly-repo"}],' '"Storage":"s3:myendpoint"}') self.assertEqual( self.papi.publish(sources=[{ 'Name': 'aptly-repo' }], architectures=['amd64'], prefix='s3:myendpoint:test/a_1', distribution='test', label='test', origin='origin', sign_skip=True), PublishEndpoint(storage='s3:myendpoint', prefix='test/a_1', distribution='test', source_kind='local', sources=[{ 'Component': 'main', 'Name': 'aptly-repo' }], architectures=['amd64'], label='test', origin='origin'))
def test_publish_default_key(self, *, rmock: requests_mock.Mocker) -> None: rmock.post("http://test/api/publish/s3%3Amyendpoint%3Atest_a__1", text='{"Architectures":["amd64"],"Distribution":"test","Label":"test",' '"Origin":"origin","Prefix":"test/a_1","SkipContents":false,' '"SourceKind":"local","Sources":[{"Component":"main","Name":"aptly-repo"}],' '"Storage":"s3:myendpoint"}') self.assertEqual( self.papi.publish( sources=[{'Name': 'aptly-repo'}], architectures=['amd64'], prefix='s3:myendpoint:test/a_1', distribution='test', label='test', origin='origin', sign_batch=True, sign_passphrase='*********', force_overwrite=True, sign_keyring="/etc/gpg-managed-keyring/pubring.pub", sign_secret_keyring="/etc/gpg-managed-keyring/secring.gpg" ), PublishEndpoint( storage='s3:myendpoint', prefix='test/a_1', distribution='test', source_kind='local', sources=[{'Component': 'main', 'Name': 'aptly-repo'}], architectures=['amd64'], label='test', origin='origin' ) )
def test_list(self, *, rmock: requests_mock.Mocker) -> None: rmock.get( "http://test/api/publish", text= '[{"Architectures":["amd64"],"Distribution":"mn-nightly","Label":"",' '"Origin":"","Prefix":"nightly/stretch","SkipContents":false,' '"SourceKind":"local","Sources":[{"Component":"main","Name":"maurusnet"}],' '"Storage":"s3:maurusnet"}]') self.assertListEqual(self.papi.list(), [ PublishEndpoint(storage='s3:maurusnet', prefix='nightly/stretch', distribution='mn-nightly', source_kind='local', sources=[{ 'Name': 'maurusnet', 'Component': 'main' }], architectures=['amd64'], label='', origin='') ])