Esempio n. 1
0
// Find all should return empty list when no results are found
func (s *TestSuite) TestFindAllEmpty(c *C) {
	// given
	locClient := client.LocationClient{Host: s.host}

	// when
	foundLocations, err := locClient.FindAllLocations()

	// then
	c.Assert(err, Equals, nil)

	c.Assert(len(foundLocations), Equals, 0)
}
Esempio n. 2
0
// Find all should return all locations
func (s *TestSuite) TestFindAll(c *C) {
	// given
	locClient := client.LocationClient{Host: s.host}

	loc1, err := locClient.AddLocation("Austin", "Texas")
	loc2, err := locClient.AddLocation("Williamsburg", "Virginia")
	// when

	foundLocations, err := locClient.FindAllLocations()

	// then
	c.Assert(err, Equals, nil)

	c.Assert(foundLocations, DeepEquals, []api.Location{loc1, loc2})
}
Esempio n. 3
0
// Delete should Delete a location
func (s *TestSuite) TestDelete(c *C) {
	// given
	locClient := client.LocationClient{Host: s.host}

	location, _ := locClient.AddLocation("Austin", "Texas")

	// when
	err := locClient.DeleteLocation(location.Id)

	// then
	c.Assert(err, Equals, nil)

	foundLocations, _ := locClient.FindAllLocations()

	c.Assert(len(foundLocations), Equals, 0)
}