def test_valid(self): path = os.path.abspath(os.path.dirname(__file__)) backup_directory = os.path.join(path, BACKUP_TEST_DIRECTORY) test_file_path = os.path.join(path, FIXTURE_DIRECTORY + '/dump.sql') wp_dir = os.path.join(path, FIXTURE_DIRECTORY + '/wp_test') self.assertIsNotNone( WPBackup.make_archive(wp_dir, test_file_path, backup_directory))
def test_parsing_wpconfig_valid_file(self): path = os.path.abspath(os.path.dirname(__file__)) path = os.path.join(path, FIXTURE_DIRECTORY) result = WPBackup.parsing_wpconfig(path) self.assertEqual(u'dbname', result[u'database']) self.assertEqual(u'user', result[u'user']) self.assertEqual(u'password', result[u'password']) self.assertEqual(u'mysql.domain.xyz.de', result[u'host'])
def test_parsing_wpconfig_valid_content(self): path = os.path.abspath(os.path.dirname(__file__)) config_path = os.path.join(path, FIXTURE_DIRECTORY + u'/wp-config.php') content = None with open(config_path, encoding=u"utf-8") as fh: content = fh.read() self.assertIsNotNone(content) result = WPBackup.parsing_wpconfig_content(content) self.assertEqual(u'dbname', result[u'database']) self.assertEqual(u'user', result[u'user']) self.assertEqual(u'password', result[u'password']) self.assertEqual(u'mysql.domain.xyz.de', result[u'host'])
def test_invalid_dump_file(self): path = os.path.abspath(os.path.dirname(__file__)) backup_directory = os.path.join(path, BACKUP_TEST_DIRECTORY) self.assertIsNone(WPBackup.make_archive('wp1', '', backup_directory))
def test_invalid_all(self): self.assertIsNone(WPBackup.make_archive('', '', ''))
def test_parsing_wpconfig_null_content(self): result = WPBackup.parsing_wpconfig_content(None) self.assertEqual({}, result)
def test_parsing_wpconfig_invalid_content(self): result = WPBackup.parsing_wpconfig_content(u"") self.assertEqual({}, result)