Permalink
Browse files

Merge pull request #80 from ReidCarlberg/master

Fixes and issue with Chatter follow tests.
  • Loading branch information...
2 parents b48faa1 + 199b99d commit 2da1f0f6b58b1b4bb5af5f694ce3eebf4316bbe1 @ReidCarlberg ReidCarlberg committed May 4, 2012
@@ -1,4 +1,4 @@
-#Mon Apr 30 11:09:07 CDT 2012
+#Fri May 04 17:11:17 CDT 2012
eclipse.preferences.version=1
endpointApiVersion=23.0
endpointEnvironment=Production/Developer Edition
@@ -10,4 +10,4 @@ metadataFormatVersion=23.0
namespacePrefix=
packageName=unpackaged
readTimeout=400
-username=labs@labs.261
+username=labs@labs.266
@@ -76,7 +76,7 @@
<targetField>Project_Snapshot__c.Date__c</targetField>
</mappings>
<name>Project Status Analytic Snapshot</name>
- <runningUser>labs@labs.261</runningUser>
+ <runningUser>labs@labs.266</runningUser>
<sourceReport>Milestone_Project_Management/Project_Snapshot</sourceReport>
<targetObject>Project_Snapshot__c</targetObject>
</AnalyticSnapshot>
@@ -35,38 +35,48 @@ private class Milestone1_Task_Chatter_Tst
{
if(!Milestone1_Schema_Helper.isOrgChatterEnabled())
return; //chatter is disabled - we can't run this test.
- Milestone1_Settings__c settings = Milestone1_Test_Utility.createDefaultCustomChatterSettings(true);
- System.assert(settings.Auto_Follow_Task__c, 'Auto Follow Task must be true for this test to work.');
- Milestone1_Project__c testProject = Milestone1_Test_Utility.sampleProject('UNIT TEST PROJECT NAME ABC123XYZ UNIQUE' + System.now());
- insert testProject;
-
- Milestone1_Milestone__c testMilestone = Milestone1_Test_Utility.sampleMilestone(testProject.Id,null,'UNIT TEST MILESTONE NAME ACB123XYZ UNIQUE' + System.now());
- insert testMilestone;
-
- Milestone1_Task__c testTask = Milestone1_Test_Utility.sampleTask(testMilestone.Id);
- testTask.Assigned_To__c = UserInfo.getUserId();
- testTask.Complete__c = false;
- insert testTask;
- sObject subscription = Database.query('Select Id, ParentId, SubscriberId from EntitySubscription where ParentId = \''+testTask.Id+'\'');
- //assert that the user is following this object
- system.assertEquals(UserInfo.getUserId(),(id) subscription.get('SubscriberId'));
+ User userObj = Milestone1_Test_Utility.createSFUser();
- testTask.Complete__c = true;
- update testTask;
+ System.runAs(userObj) {
- List<sObject> subscriptionList = Database.query('Select Id, ParentId, SubscriberId from EntitySubscription where ParentId = \''+testTask.Id+'\'');
- //assert that no one is following this object after its marked as complete
- system.assertEquals(0,subscriptionList.size());
+ Milestone1_Settings__c settings = Milestone1_Test_Utility.createDefaultCustomChatterSettings(true);
+ System.assert(settings.Auto_Follow_Task__c, 'Auto Follow Task must be true for this test to work.');
+
+ Milestone1_Project__c testProject = Milestone1_Test_Utility.sampleProject('UNIT TEST PROJECT NAME ABC123XYZ UNIQUE' + System.now());
+ insert testProject;
+
+ Milestone1_Milestone__c testMilestone = Milestone1_Test_Utility.sampleMilestone(testProject.Id,null,'UNIT TEST MILESTONE NAME ACB123XYZ UNIQUE' + System.now());
+ insert testMilestone;
+
+ Milestone1_Task__c testTask = Milestone1_Test_Utility.sampleTask(testMilestone.Id);
+ testTask.Assigned_To__c = UserInfo.getUserId();
+ testTask.Complete__c = false;
+ insert testTask;
+
+ sObject subscription = Database.query('Select Id, ParentId, SubscriberId from EntitySubscription where ParentId = \''+testTask.Id+'\'');
+ //assert that the user is following this object
+ system.assertEquals(UserInfo.getUserId(),(id) subscription.get('SubscriberId'));
+
+ testTask.Complete__c = true;
+ update testTask;
+
+ List<sObject> subscriptionList = Database.query('Select Id, ParentId, SubscriberId from EntitySubscription where ParentId = \''+testTask.Id+'\'');
+ //assert that no one is following this object after its marked as complete
+ system.assertEquals(0,subscriptionList.size());
+ }
}
static testMethod void testChatterTaskReassignment()
{
if(!Milestone1_Schema_Helper.isOrgChatterEnabled())
return; //chatter is disabled - we can't run this test.
-
+
+ User userMain = Milestone1_Test_Utility.createSFUser();
+
+ System.runAs(userMain) {
User userObj = Milestone1_Test_Utility.createSFUser();
Milestone1_Test_Utility.createDefaultCustomChatterSettings(true);
@@ -92,6 +102,7 @@ private class Milestone1_Task_Chatter_Tst
List<sObject> subscriptionList = Database.query('Select Id, ParentId, SubscriberId from EntitySubscription where ParentId = \''+testTask.Id+'\' and SubscriberId = \''+UserInfo.getUserId()+'\'');
//assert that no one is following this object after its marked as complete
system.assertEquals(0,subscriptionList.size());
+ }
}
@@ -51,7 +51,7 @@
<useReportChart>false</useReportChart>
</components>
</rightSection>
- <runningUser>labs@labs.261</runningUser>
+ <runningUser>labs@labs.266</runningUser>
<textColor>#000000</textColor>
<title>Milestones PM Individual Dashboard</title>
<titleColor>#000000</titleColor>
@@ -61,7 +61,7 @@
<useReportChart>false</useReportChart>
</components>
</rightSection>
- <runningUser>labs@labs.261</runningUser>
+ <runningUser>labs@labs.266</runningUser>
<textColor>#000000</textColor>
<title>Milestones PM Project Snapshots</title>
<titleColor>#000000</titleColor>
@@ -220,8 +220,8 @@ IF( Project_Task__c &lt;&gt; null, &apos;Task&apos;,&apos;&apos;)))</formula>
<pluralLabel>Nags</pluralLabel>
<searchLayouts>
<excludedStandardButtons>Accept</excludedStandardButtons>
- <excludedStandardButtons>New</excludedStandardButtons>
<excludedStandardButtons>ChangeOwner</excludedStandardButtons>
+ <excludedStandardButtons>New</excludedStandardButtons>
</searchLayouts>
<sharingModel>ReadWrite</sharingModel>
<validationRules>

0 comments on commit 2da1f0f

Please sign in to comment.