From b9dd6a0e96e1db29d61287fdea6c33c2f7b99c12 Mon Sep 17 00:00:00 2001 From: Dave Reid <dave@davereid.net> Date: Thu, 16 Jun 2011 10:18:17 -0500 Subject: [PATCH] Issue #914210 by jyee, Dave Reid: Added mapper for user raw password. --- feeds.info | 7 +++--- plugins/FeedsUserProcessor.inc | 4 ++++ tests/feeds.test | 40 +++++++++++++++++---------------- tests/feeds/users.csv | 12 +++++----- tests/feeds_processor_user.test | 24 +++++++++----------- 5 files changed, 45 insertions(+), 42 deletions(-) diff --git a/feeds.info b/feeds.info index b0b69052..b568755d 100644 --- a/feeds.info +++ b/feeds.info @@ -1,10 +1,11 @@ name = Feeds description = Aggregates RSS/Atom/RDF feeds, imports CSV files and more. package = Feeds +core = 7.x + dependencies[] = ctools dependencies[] = job_scheduler -files[] = feeds.module -files[] = feeds.install + files[] = includes/FeedsConfigurable.inc files[] = includes/FeedsImporter.inc files[] = includes/FeedsSource.inc @@ -28,5 +29,3 @@ files[] = views/feeds_views_handler_field_log_message.inc files[] = views/feeds_views_handler_field_severity.inc files[] = views/feeds_views_handler_field_source.inc files[] = views/feeds_views_handler_filter_severity.inc -core = 7.x -php = 5.2 diff --git a/plugins/FeedsUserProcessor.inc b/plugins/FeedsUserProcessor.inc index 0b229d21..2335880e 100644 --- a/plugins/FeedsUserProcessor.inc +++ b/plugins/FeedsUserProcessor.inc @@ -166,6 +166,10 @@ class FeedsUserProcessor extends FeedsProcessor { 'name' => t('Created date'), 'description' => t('The created (e. g. joined) data of the user.'), ), + 'pass' => array( + 'name' => t('Unencrypted Password'), + 'description' => t('The unencrypted user password.'), + ), ); if (module_exists('openid')) { $targets['openid'] = array( diff --git a/tests/feeds.test b/tests/feeds.test index 9798f583..11f30cd0 100644 --- a/tests/feeds.test +++ b/tests/feeds.test @@ -16,28 +16,29 @@ class FeedsWebTestCase extends DrupalWebTestCase { * please don't pass duplicates of what is defined below! */ function setUp() { - // We ensure the taxonomy module is enabled first to prevent issues later - // on where plugins aren't available. - parent::setUp(array('taxonomy')); - $modules = array( - 'image', - 'file', - 'field', - 'field_ui', - 'ctools', - 'job_scheduler', - 'feeds', - 'feeds_ui', - ); $args = func_get_args(); - if (!empty($args[0]) && is_array($args[0])) { - foreach ($args[0] as $m) { - $modules[] = $m; - } + if (isset($args[0]) && is_array($args[0])) { + $modules = $args[0]; + } + elseif (count($args) > 1) { + $modules = $args; } - module_enable($modules, TRUE); - $this->resetAll(); + else { + $modules = array(); + } + + $modules[] = 'taxonomy'; + $modules[] = 'image'; + $modules[] = 'file'; + $modules[] = 'field'; + $modules[] = 'field_ui'; + $modules[] = 'feeds'; + $modules[] = 'feeds_ui'; + $modules[] = 'ctools'; + $modules[] = 'job_scheduler'; + $modules = array_unique($modules); + parent::setUp($modules); // Add text formats Directly. $filtered_html_format = array( @@ -78,6 +79,7 @@ class FeedsWebTestCase extends DrupalWebTestCase { 'administer nodes', 'administer content types', 'bypass node access', + 'administer users', )); $this->drupalLogin($this->admin_user); diff --git a/tests/feeds/users.csv b/tests/feeds/users.csv index f0a68149..aede81ca 100644 --- a/tests/feeds/users.csv +++ b/tests/feeds/users.csv @@ -1,6 +1,6 @@ -name,mail,since -Morticia,morticia@example.com,1244347500 -Fester,fester@example.com,1241865600 -Gomez,gomez@example.com,1228572000 -Wednesday,wednesdayexample.com,1228347137 -Pugsley,pugsley@example.com,1228260225 \ No newline at end of file +name,mail,since,password +Morticia,morticia@example.com,1244347500,mort +Fester,fester@example.com,1241865600,fest +Gomez,gomez@example.com,1228572000,gome +Wednesday,wednesdayexample.com,1228347137,wedn +Pugsley,pugsley@example,1228260225,pugs diff --git a/tests/feeds_processor_user.test b/tests/feeds_processor_user.test index 3272b999..324625be 100644 --- a/tests/feeds_processor_user.test +++ b/tests/feeds_processor_user.test @@ -9,7 +9,6 @@ * Test aggregating a feed as data records. */ class FeedsCSVtoUsersTest extends FeedsWebTestCase { - public static function getInfo() { return array( 'name' => 'CSV import to users', @@ -18,22 +17,10 @@ class FeedsCSVtoUsersTest extends FeedsWebTestCase { ); } - /** - * Set up test. - */ - public function setUp() { - parent::setUp(); - $this->drupalLogin($this->drupalCreateUser(array( - 'administer feeds', - 'administer users', - ))); - } - /** * Test node creation, refreshing/deleting feeds and feed items. */ public function test() { - // Create an importer. $this->createImporterConfiguration('User import', 'user_import'); @@ -59,6 +46,11 @@ class FeedsCSVtoUsersTest extends FeedsWebTestCase { 'target' => 'created', 'unique' => FALSE, ), + '3' => array( + 'source' => 'password', + 'target' => 'pass', + 'unique' => 0, + ), ); $this->addMappings('user_import', $mappings); @@ -96,5 +88,11 @@ class FeedsCSVtoUsersTest extends FeedsWebTestCase { $this->assertEqual($count, 0, t('No imported user was assigned the administrator role.')); // @todo Test status setting, update existing and role settings. + + // Attempt to log in as one of the imported users. + $account = user_load_by_name('Morticia'); + $this->assertTrue($account, 'Imported user account loaded.'); + $account->pass_raw = 'mort'; + $this->drupalLogin($account); } } -- GitLab