use of com.instructure.canvasapi2.models.User in project play-cookbook by spinscale.
the class SolrSearchTest method testQueryResultIds.
@Test
public void testQueryResultIds() {
User u = User.find("byName", "alex").first();
List<String> users = new Query("name:alex", User.class).fetchIds();
assertEquals(u.id.toString(), users.get(0));
}
use of com.instructure.canvasapi2.models.User in project play-cookbook by spinscale.
the class CsvTest method readComplexEntityWithOtherEntites.
@Test
public void readComplexEntityWithOtherEntites() {
User u = new User();
u.name = "alex";
u.currentCar = c;
u.save();
u = User.findById(1L);
assertNotNull(u);
assertEquals("alex", u.name);
assertValidCar(u.currentCar, "BMW", "320");
}
use of com.instructure.canvasapi2.models.User in project play-cookbook by spinscale.
the class JsonRenderTest method testThatJsonRenderingWorks.
@Test
public void testThatJsonRenderingWorks() {
Response response = GET("/user/1");
assertIsOk(response);
User user = new Gson().fromJson(getContent(response), User.class);
assertNotNull(user);
assertNull(user.password);
assertNull(user.secrets);
assertEquals(user.login, "alex");
assertEquals(user.address.city, "Munich");
assertContentMatch("\"uri\":\"/user/1\"", response);
}
use of com.instructure.canvasapi2.models.User in project play-cookbook by spinscale.
the class CsvTest method saveEntityWithLinkToAnother.
@Test
public void saveEntityWithLinkToAnother() throws Exception {
User u = new User();
u.name = "alex";
u.currentCar = c;
u.save();
String data = FileUtils.readFileToString(new File("/tmp/User.csv"));
String expected = "\"1\"\t\"alex\"\t\"#Car#1\"\n";
assertEquals(expected, data);
}
use of com.instructure.canvasapi2.models.User in project play-cookbook by spinscale.
the class DigestRequest method isAuthorized.
public boolean isAuthorized() {
User user = User.find("byName", params.get("username")).first();
if (user == null) {
throw new UnauthorizedDigest(params.get("realm"));
}
String digest = createDigest(user.apiPassword);
return digest.equals(params.get("response"));
}
Aggregations