Exemplo n.º 1
0
 def test_requires_confirmation(self):
     "User must confirm the drop or it will be aborted."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.abort') as abort:
             confirm.return_value = False
             postgres.reset_cluster()
             self.assertFalse(self.mocks['sudo'].called)
             self.assertTrue(abort.called)
Exemplo n.º 2
0
 def test_requires_confirmation(self):
     "User must confirm the drop or it will be aborted."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.abort') as abort:
             confirm.return_value = False
             postgres.reset_cluster()
             self.assertFalse(self.mocks['sudo'].called)
             self.assertTrue(abort.called)
Exemplo n.º 3
0
 def test_configure_encoding(self):
     "Use given encoding when creating cluster."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             version.return_value = '9.1'
             postgres.reset_cluster(encoding='LATIN1')
             self.assertSudoCommand('pg_dropcluster --stop 9.1 main')
             self.assertSudoCommand('pg_createcluster --start -e LATIN1 9.1 main')
Exemplo n.º 4
0
 def test_configure_cluster(self):
     "Use non-main cluster if given."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             version.return_value = '9.1'
             postgres.reset_cluster(pg_cluster='other')
             self.assertSudoCommand('pg_dropcluster --stop 9.1 other')
             self.assertSudoCommand('pg_createcluster --start -e UTF-8 9.1 other')
Exemplo n.º 5
0
 def test_configure_version(self):
     "Use given version without detection if given."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             postgres.reset_cluster(pg_version='8.4')
             self.assertSudoCommand('pg_dropcluster --stop 8.4 main')
             self.assertSudoCommand('pg_createcluster --start -e UTF-8 8.4 main')
             self.assertFalse(version.called)
Exemplo n.º 6
0
 def test_default_reset(self):
     "Reset default cluster. Version must be detected."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             version.return_value = '9.1'
             postgres.reset_cluster()
             self.assertSudoCommand('pg_dropcluster --stop 9.1 main')
             self.assertSudoCommand('pg_createcluster --start -e UTF-8 9.1 main')
Exemplo n.º 7
0
 def test_configure_encoding(self):
     "Use given encoding when creating cluster."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             version.return_value = '9.1'
             postgres.reset_cluster(encoding='LATIN1')
             self.assertSudoCommand('pg_dropcluster --stop 9.1 main')
             self.assertSudoCommand(
                 'pg_createcluster --start -e LATIN1 9.1 main')
Exemplo n.º 8
0
 def test_configure_cluster(self):
     "Use non-main cluster if given."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             version.return_value = '9.1'
             postgres.reset_cluster(pg_cluster='other')
             self.assertSudoCommand('pg_dropcluster --stop 9.1 other')
             self.assertSudoCommand(
                 'pg_createcluster --start -e UTF-8 9.1 other')
Exemplo n.º 9
0
 def test_configure_version(self):
     "Use given version without detection if given."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             postgres.reset_cluster(pg_version='8.4')
             self.assertSudoCommand('pg_dropcluster --stop 8.4 main')
             self.assertSudoCommand(
                 'pg_createcluster --start -e UTF-8 8.4 main')
             self.assertFalse(version.called)
Exemplo n.º 10
0
 def test_default_reset(self):
     "Reset default cluster. Version must be detected."
     with patch('argyle.postgres.confirm') as confirm:
         with patch('argyle.postgres.detect_version') as version:
             confirm.return_value = True
             version.return_value = '9.1'
             postgres.reset_cluster()
             self.assertSudoCommand('pg_dropcluster --stop 9.1 main')
             self.assertSudoCommand(
                 'pg_createcluster --start -e UTF-8 9.1 main')