use of com.kickstarter.libs.RefTag in project android-oss by kickstarter.
the class RefTagUtilsTest method testFindRefTagCookieForProject_WhenCookieExists.
@Test
public void testFindRefTagCookieForProject_WhenCookieExists() {
final CookieManager cookieManager = new CookieManager();
final CookieStore cookieStore = cookieManager.getCookieStore();
final Project project = ProjectFactory.project();
final RefTag refTag = RefTag.recommended();
// set and retrieve the cookie
cookieStore.add(null, new HttpCookie("ref_" + project.id(), refTag.tag() + "%3F" + SystemUtils.secondsSinceEpoch()));
final HttpCookie cookie = RefTagUtils.findRefTagCookieForProject(project, cookieManager, sharedPreferences);
assertNotNull(cookie);
assertEquals(RefTagUtils.cookieNameForProject(project), cookie.getName());
assertEquals(RefTagUtils.cookieValueForRefTag(refTag), cookie.getValue());
}
use of com.kickstarter.libs.RefTag in project android-oss by kickstarter.
the class RefTagUtilsTest method testBuildCookieForRefTagAndProject_WithWellFormedUrl.
@Test
public void testBuildCookieForRefTagAndProject_WithWellFormedUrl() {
final Project project = ProjectFactory.project();
final RefTag refTag = RefTag.category();
final HttpCookie cookie = RefTagUtils.buildCookieWithRefTagAndProject(refTag, project);
assertNotNull(cookie);
assertEquals(ProjectUtils.timeInSecondsUntilDeadline(project).longValue(), cookie.getMaxAge());
assertEquals("www.kickstarter.com", cookie.getDomain());
}
Aggregations