-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MPIR-401] Mailing list subscribe and unsubscribe links
- Loading branch information
Showing
3 changed files
with
37 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import com.meterware.httpunit.GetMethodWebRequest; | ||
import com.meterware.httpunit.TextBlock; | ||
import com.meterware.httpunit.WebConversation; | ||
import com.meterware.httpunit.WebLink; | ||
import com.meterware.httpunit.WebRequest; | ||
import com.meterware.httpunit.WebResponse; | ||
|
||
|
@@ -73,13 +74,19 @@ public void testReport() | |
assertEquals( getString( "report.mailing-lists.title" ), textBlocks[0].getText() ); | ||
assertEquals( getString( "report.mailing-lists.intro" ), textBlocks[1].getText() ); | ||
|
||
// MPIR-385: Test emails starts with 'mailto:' | ||
// MPIR-385 + MPIR-401: Test links are URIs otherwise assume a plain email address | ||
String post = getString("report.mailing-lists.column.post"); | ||
assertEquals( "mailto:[email protected]", response.getLinkWith( post ).getAttribute( "href" ) ); | ||
WebLink[] postLinks = response.getMatchingLinks( WebLink.MATCH_CONTAINED_TEXT, post ); | ||
assertEquals( "mailto:[email protected]", postLinks[0].getAttribute( "href" ) ); | ||
assertEquals( "mailto:[email protected]", postLinks[1].getAttribute( "href" ) ); | ||
String subscribe = getString("report.mailing-lists.column.subscribe"); | ||
assertEquals( "MAILTO:[email protected]", response.getLinkWith( subscribe ).getAttribute( "href" ) ); | ||
WebLink[] subscribeLinks = response.getMatchingLinks( WebLink.MATCH_CONTAINED_TEXT, subscribe ); | ||
assertEquals( "MAILTO:[email protected]", subscribeLinks[0].getAttribute( "href" ) ); | ||
assertEquals( "MAILTO:[email protected]", subscribeLinks[1].getAttribute( "href" ) ); | ||
String unsubscribe = getString("report.mailing-lists.column.unsubscribe"); | ||
assertNull( response.getLinkWith( unsubscribe ) ); | ||
WebLink[] unsubscribeLinks = response.getMatchingLinks( WebLink.MATCH_CONTAINED_TEXT, unsubscribe ); | ||
assertTrue( unsubscribeLinks.length == 1 ); | ||
assertEquals( "https://example.com/unsubscribe", unsubscribeLinks[0].getAttribute( "href" ) ); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,12 @@ under the License. | |
<post>[email protected]</post> | ||
<subscribe>MAILTO:[email protected]</subscribe> | ||
</mailingList> | ||
<mailingList> | ||
<name>Test List 2</name> | ||
<post>[email protected]</post> | ||
<subscribe>MAILTO:[email protected]</subscribe> | ||
<unsubscribe>https://example.com/unsubscribe</unsubscribe> | ||
</mailingList> | ||
</mailingLists> | ||
<build> | ||
<plugins> | ||
|
@@ -51,4 +57,4 @@ under the License. | |
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
</project> |