Beispiel #1
0
 def test_env_ssl_false(self):
     site_info = SiteInfo(
         'drop-temp',
         'test_crm',
         get_test_data_folder('data'),
         get_test_cert_folder('cert')
     )
     expected = {
         'ALLOWED_HOSTS': 'westcountrycoders.co.uk',
         'AWS_S3_ACCESS_KEY_ID': 'APPLE',
         'AWS_S3_SECRET_ACCESS_KEY': 'PINEAPPLE',
         'DB_IP': '10.11.10.10',
         'DB_PASS': '******',
         'DEFAULT_FROM_EMAIL': '*****@*****.**',
         'DOMAIN': 'westcountrycoders.co.uk',
         'FTP_STATIC_DIR': 'z1',
         'FTP_STATIC_URL': 'a1',
         'MAILGUN_ACCESS_KEY': 'abc',
         'MAILGUN_SERVER_NAME': 'def',
         'MANDRILL_API_KEY': 'b3',
         'MANDRILL_USER_NAME': 'b4',
         'MEDIA_ROOT': '/home/web/repo/project/test_crm/files/',
         'NORECAPTCHA_SECRET_KEY': 'pqr',
         'NORECAPTCHA_SITE_KEY': 'stu',
         'OPBEAT_APP_ID': '123',
         'OPBEAT_ORGANIZATION_ID': '123',
         'OPBEAT_SECRET_TOKEN': '123',
         'SECRET_KEY': 'jkl',
         'SENDFILE_ROOT': 'mno',
         'SSL': 'False',
         'STRIPE_PUBLISH_KEY': 'stu',
         'STRIPE_SECRET_KEY': 'vwx',
         'TESTING': 'False',
     }
     self.assertDictEqual(expected, site_info.env())
Beispiel #2
0
def backup_php_site(server_name, site_name):
    """

    legalsecretaryjournal_com
    TODO Only really need to backup everything in the 'images' and 'sites'
    folder.
    """
    site_info = SiteInfo(server_name, site_name)
    backup_path = site_info.backup().get('path')
    print(green("Backup files on '{}'").format(env.host_string))
    path = Path(site_name, 'files')
    print(yellow(path.remote_folder()))
    run('mkdir -p {0}'.format(path.remote_folder()))
    # remove '.gz' from end of tar file
    #  tar_file = os.path.splitext(path.remote_file())[0]
    #  with cd('/home/legalsec/legalsecretaryjournal.com/'):
    #      first = True
    #      for folder in path.php_folders():
    #          if first:
    #              first = False
    #              run('tar cvf {} {}'.format(tar_file, folder))
    #          else:
    #              run('tar rvf {} {}'.format(tar_file, folder))
    #  run('gzip {}'.format(tar_file))
    #  # list the contents of the archive
    #  run('tar ztvf {}'.format(path.remote_file()))
    with cd(backup_path):
        run('tar -cvzf {} .'.format(path.remote_file()))
    get(path.remote_file(), path.local_file())
Beispiel #3
0
class TestSiteInfoPhp(unittest.TestCase):
    def setUp(self):
        self.site_info = SiteInfo("drop-temp", "hatherleigh_info", get_test_data_folder("data_php"))

    def test_is_mysql(self):
        self.assertEquals(True, self.site_info.is_mysql)

    def test_is_php(self):
        self.assertEquals(True, self.site_info.is_php)

    def test_packages(self):
        packages = self.site_info.packages()
        self.assertEqual(2, len(packages))
        expected = {"name": "drupal", "tar": "--strip-components=1", "archive": "drupal-6.29.tar.gz"}
        self.assertDictEqual(expected, packages[0])
        expected = {"name": "date", "archive": "date-6.x-2.9.tar.gz"}
        self.assertDictEqual(expected, packages[1])

    def test_mysql_db_username(self):
        self.assertEquals("hatherleigh_info", self.site_info.db_user)

    def test_mysql_db_username_too_long(self):
        site_info = SiteInfo("drop-user", "very_long_site_name", get_test_data_folder("data_php"))
        with self.assertRaises(TaskError) as cm:
            site_info.db_user()
        self.assertIn("maximum length of user name for mysql", cm.exception.value)
Beispiel #4
0
 def setUp(self):
     self.site_info = SiteInfo("drop-temp", "hatherleigh_info", get_test_data_folder("data_php"))
Beispiel #5
0
 def test_mysql_db_username_too_long(self):
     site_info = SiteInfo("drop-user", "very_long_site_name", get_test_data_folder("data_php"))
     with self.assertRaises(TaskError) as cm:
         site_info.db_user()
     self.assertIn("maximum length of user name for mysql", cm.exception.value)